Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto Click Button and pass through all data

Status
Not open for further replies.

emmals

Programmer
May 16, 2012
1
0
0
GB
I am new to Javascript and have some code I need to edit. Please can someone suggest how i can get this function to work without clicking the <ul> class ct-group ?

Code:
function triggerCTPartButtonClick(oUL) {

    try {

        optionalLog('man', 'triggerCTPartButtonClick');
        $(oUL).parent().parent().find("button.partselect").click();

    } catch (ex) {
        console.log(ex.message);
    }

}
When you click on below it loads the function, but i need it to auto load.
Code:
strGroup = gfCStr(objRs("Group"))
if strGroup <> "" then
    %><ul class="ct-group" onclick="triggerBootPartButtonClick(this);"><%
    strSplit = split(strGroup, ",")
    for intcount = 0 to ubound(strSplit)-1
       strItem = strSplit(intcount)
        if (strItem <> "") then
            %><li><%=strItem%></li><%
        end if
    next
    %></ul><%
end if
%>
Added code for button



Code:
      <button class="fixmed partselect" 

                                        data-ldLength = ""
                                        data-term1 = "<%=gfCStr(objRs("Term1"))%>"
                                        data-term2 = "<%=gfCStr(objRs("Term2"))%>"
                                        data-ldCPBoot = "<%=gfCStr(objRs("Boot1"))%>"
                                        data-ldDTBoot = "<%=gfCStr(objRs("Boot2"))%>"
                                        data-ldLeadQty = "1"
                                        data-ldQtyReq = "<%=gfCStr(objRs("QtyReq"))%>"
                                        data-ldLocation = ""

                                        data-place="vwcutlist" 
                                        data-docmode="<%=docmode%>" 
                                        data-docref="<%=docref%>" 
                                        data-part="<%=gfCStr(objRs("PartNo"))%>" 
                                        data-wo="<%=gfCStr(objRs("Works"))%>" 
                                        data-tray="<%=gfCStr(objRs("Tra"))%>" 
                                        data-cable="<%=gfCStr(objRs("Cabl"))%>" 

                                        onclick="selectListPart(this, 'vwwo');"><%=gfCStr(objRs("PartNo"))%>
                                         </button>


Tried the below code - I get the alert, but the button still doesn't click as when clicking from the UL.
Code:
           (function () {
try {
alert("hello")
    optionalLog('man', 'triggerCTPartButtonClick');
    $("button.partselect").click();
 } catch (ex) {
    console.log(ex.message);
   }     
  } 
)();
</script>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top