Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2002
    Location
    Charlotte
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Trying to post dynamically created data

    What is ELpntr and what would my field name be for each row created? OAReff_Bonus1,OAReff_Bonus2,OAReff_Bonus3?

    var content2='<input size=9 name="OAReff_Bonus'+ELpntr+'A">';

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Do you think with that 1-line code we can accurately answer your question?
    I can only guess that it would look like this:
    OAReff_Bonus1A
    OAReff_Bonus2A
    OAReff_Bonus3A

    If you want accurate answer, post more codes.

  • #3
    New Coder
    Join Date
    Sep 2002
    Location
    Charlotte
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks.........Your correct!

    It is 1A, 2A, 3A.....ect do you know any way to capture that with a variable for 1A, 2A, 3A....ect? Because I won't know how many rows the user is going to add. Full code for you below

    <table border=1 cellpadding=0 cellspacing=0" width="800px" ID="OASales">
    <Script>

    function addRow()
    {
    ELpntr++;

    var ELpntr=1;
    var content1='';

    content1='<select name="SalesStaff'+ELpntr+'" onChange="addRow()">';

    <% set conntemp=server.createobject("adodb.connection")
    conntemp.open DSNCompany

    SQL="Select eepnamelast,eepnamefirst from (Emppers Inner Join Empcomp ON(empcomp.EecEmplStatus <>'T' AND emppers.eepeeid=empcomp.eeceeid)) order by eepnamelast"
    set rstemp=conntemp.execute(SQL)

    Response.write "content1+='<option value=""""></option>';" & vbcrlf

    'This loop creates all the options
    do until rstemp.eof
    sFullName = Trim(rstemp("eepnamelast")) & "_" & Trim(rstemp("eepnamefirst"))
    sFullName = Replace(sFullName,"'", " ")

    sValueName = Trim(rstemp("eepnamelast"))
    sValueName = Replace(sValueName,"'", " ")

    Response.Write "content1+='<option Value="""& sValueName & """>" & sFullName & "</option>';" & vbcrlf

    rstemp.movenext

    Loop

    rstemp.close
    conntemp.close

    'This closes the select list
    Response.write "content1+='</select></td>';"

    %>


    var content2='<input size=9 name="OAReff_Bonus'+ELpntr+'A">';
    var content3='<input size=9 name="OALead_Bonus'+ELpntr+'B">';
    var content4='<input size=9 name="OAChrg_Dept'+ELpntr+'C">';
    var content5='<input size=9 name="OAComm'+ELpntr+'D">';
    var content6='<input size=9 name="OAGty_Comm'+ELpntr+'E">';
    var content7='<input size=9 name="OAAdv_Comm'+ELpntr+'F">';
    var content8='<input size=9 name="OAPTO_Dollars'+ELpntr+'G">';
    var content9='<input size=9 name="OAGty_Comm'+ELpntr+'H">';

    tb=document.createElement("TBODY");
    document.getElementById("OASales").appendChild(tb);
    row=document.createElement("TR");
    cell1 = document.createElement("TD");
    cell2 = document.createElement("TD");
    cell3 = document.createElement("TD");
    cell4 = document.createElement("TD");
    cell5 = document.createElement("TD");
    cell6 = document.createElement("TD");
    cell7 = document.createElement("TD");
    cell8 = document.createElement("TD");
    cell9 = document.createElement();
    cell1.innerHTML=content1;
    cell2.innerHTML=content2;
    cell3.innerHTML=content3;
    cell4.innerHTML=content4;
    cell5.innerHTML=content5;
    cell6.innerHTML=content6;
    cell7.innerHTML=content7;
    cell8.innerHTML=content8;
    cell9.innerHTML=content9;
    row.appendChild(cell1);
    row.appendChild(cell2);
    row.appendChild(cell3);
    row.appendChild(cell4);
    row.appendChild(cell5);
    row.appendChild(cell6);
    row.appendChild(cell7);
    row.appendChild(cell8);
    row.appendChild(cell9);
    tabBody=document.getElementsByTagName("TBODY").item(2);
    tabBody.appendChild(row);
    }



    </script>

    <td width=250>
    <% set conntemp=server.createobject("adodb.connection")
    conntemp.open DSNCompany

    SQL="Select eepnamelast,eepnamefirst from (Emppers Inner Join Empcomp ON(empcomp.EecEmplStatus <>'T' AND emppers.eepeeid=empcomp.eeceeid)) order by eepnamelast"
    set rstemp=conntemp.execute(SQL)

    Response.write "<select name=""SalesStaff"" onChange=""addRow()""><option value=""></option>"

    'This loop creates all the options
    do until rstemp.eof
    Response.Write "<option value=""></option><option Value="""& rstemp("eepnamelast")& """>" & _
    rstemp("eepnamelast") & "_" & rstemp("eepnamefirst") & _
    "</option>"

    rstemp.movenext

    Loop

    rstemp.close
    conntemp.close

    'This closes the select list
    Response.write "</select></td>"

    %>

    <td><font size=-1 ><input name="OAReff_Bonus" size="9" value="<%=OAReff_Bonus%>"></TD>
    <td><font size=-1 ><input name="OALead_Bonus" size="9" value="<%=OALead_Bonus%>"></TD>
    <td><font size=-1 ><input name="OAChrg_Dept" size="9" value="<%=OAChrg_Dept%>"></TD>
    <td><font size=-1 ><input name="OAComm" size="9" value="<%=OAComm%>"></TD>
    <td><font size=-1 ><input name="OAGty_Comm" size="9" value="<%=OAGty_Comm%>"></TD>
    <td><font size=-1 ><input name="OAAdv_Comm" size="9" value="<%=OAAdv_Comm%>"></TD>
    <td><font size=-1 ><input name="OAPTO_Dollars" size="9" value="<%=OAPTO_Dollars%>"></TD>
    </TR>
    </table>

    The asp page it is posting to works for the first and second row if I do....

    OAReff_Bonus = Request.Form("OAReff_Bonus")
    OALead_Bonus = Request.Form("OALead_Bonus")
    OAChrg_Dept = Request.Form("OAChrg_Dept")
    OAComm = Request.Form("OAComm")
    OAGty_Comm = Request.Form("OAGty_Comm")
    OAAdv_Comm = Request.Form("OAAdv_Comm")
    OAPTO_Dollars = Request.Form("OAPTO_Dollars")

    OAReff_Bonus = Request.Form("OAReff_Bonus1A")
    OALead_Bonus = Request.Form("OALead_Bonus1B")
    OAChrg_Dept = Request.Form("OAChrg_Dept11C")
    OAComm = Request.Form("OAComm1D")
    OAGty_Comm = Request.Form("OAGty_Comm1E")
    OAAdv_Comm = Request.Form("OAAdv_Comm1F")
    OAPTO_Dollars = Request.Form("OAPTO_Dollars1G")

    But it would be great if I could use some kind of variable!

    Thanks in advance,
    Dan
    Last edited by dan18088; 10-14-2003 at 12:12 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •