form problem

Discussion in 'ASP.NET / ASP.NET Core' started by gibson, Dec 17, 2004.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hey can someone tell how a get the value of the textfield from the first form (form1) Because it don't works.


    code:


    %>
    <form action="" name="form1">
    <td width='100' align='center'><input type="text" name="aantal" />
    </form>
    <form action="boeking3.asp" method="post" name="form";">
    <input type="hidden" name="hdnAction" value='<%=RowCounter%>' />
    <td width='140' align='center'><input type="image" src="images/caddie.gif" onclick="this.form.hdnAction.value='<%=RowCounter%>';" name="B3" > </td></tr>
    </FORM>
    <%
    Thanks


    Post Edited (gibson) : 12/17/2004 1:46:32 PM GMT
     
  2. Still got the same error. If i do the things away with straantal it works when it is there i got the problem (see blue lines)
    Error:

    Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
    [Microsoft][ODBC Microsoft Access-stuurprogramma]Het veld COUNT is onjuist
    /asp-gip10/boeking3.asp, line 57




    [*]Soort browser:
    Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)



    [*]Pagina:
    POST 37 bytes naar /asp-gip10/boeking3.asp



    [*]POST Data:
    hdnAction=2&amp;aantal_r2=5&amp;B3.x=2&amp;B3.y=2

    The code for printing the data in an .inc file
    <%
    Dim RowCounter
    RowCounter=1
    Do while not rstKlanten.EOF

    response.Write "<td width='60' align='center'>" &amp; rstKlanten("IdNummer") &amp; " </td>"
    response.Write "<td width='230' align='center'>" &amp; rstKlanten("Titel") &amp; " </td>"
    response.Write "<td width='300'align='center'>" &amp; rstKlanten("artikel") &amp; " </td>"
    response.Write "<td width='70' align='center'>" &amp; rstKlanten("Prijs") &amp; " </td>"
    response.Write "<td width='90' align='center'>" &amp; rstKlanten("Kode") &amp; " </td>"
    %>
    <FORM action="boeking3.asp" method="post" name="form">
    <input type="hidden" name="hdnAction" value='<%=RowCounter%>' />

    <td width='100' align='center'><input type="text" name="aantal_r<%=RowCounter %>" />
    <td width='130' align='center'><input type="image" src="images/caddie.gif" onclick="this.form.hdnAction.value='<%=RowCounter%>';" name="B3" > </td></tr>
    </FORM>
    <%
    RowCounter = RowCounter+1
    rstKlanten.MoveNext
    Loop
    %>

    code in the booking 3 page to write the lines away:




    ' Verbinding


    strConnstring= "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &amp; Server.MapPath("db1.mdb")


    set cnDB = Server.CreateObject("ADODB.Connection")


    cnDB.open strConnstring


    set rstKlanten5 = cnDB.execute("SELECT * FROM tblprijslijst")


    rstKlanten5.movefirst


    set rstKlanten = cnDB.execute("Select KlantID from qryKlanten ")


    do while not rstKlanten5.eof


    dim intgetal8


    intgetal8 = Request.Form("hdnAction")


    intIdNummer = rstKlanten5("IdNummer")


    straantal=request.form("aantal_r" + intgetal8)


    if cint(intgetal8) = cint(intIdNummer) then


    strRang = rstKlanten5("Id_Rang")


    strOrde = rstKlanten5("Id_Orde")


    strTitel = rstKlanten5("Titel")


    strArtikel = rstKlanten5("artikel")


    strPrijsE = rstKlanten5("PrijsE")


    strPrijslijst = rstKlanten5("Prijs")


    strKOde = rstKlanten5("Kode")


    ' Verbinding


    strConnstring= "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &amp; Server.MapPath("db1.mdb")


    set cnDB = Server.CreateObject("ADODB.Connection")


    cnDB.open strConnstring


    strSql = "Insert into tblBestelling(klantid,Id_Rang, Id_Orde, Titel, artikel, PrijsE, Prijs, Kode, aantalstuks?) "


    strSql = strSql + "Values('" &amp; strklantid &amp; "','" &amp; strRang &amp; "','" &amp; strOrde &amp; "','" &amp; strTitel &amp; "','" &amp; strArtikel &amp; "','" &amp; strPrijsE &amp; "','" &amp; strPrijslijst &amp; "','" &amp; strKOde &amp; "','" &amp; straantal &amp; "')"


    cnDB.Execute(strSql)


    rstKlanten5.movenext


    else


    rstKlanten5.movenext


    end if


    loop


    cnDB.Close


    %>
     
  3. I think you can't. You only receive the values of the form you are posting, which is the form which has the submit button you pushed. Only if you use 1 big form, and determine the row which you are in, you are able to get the values of the other inputs.


    One solution might be to give your inputs a name like aantal_r<%=RowCounter %>. With method you are using (onclick="this.form.hdnAction.value='<%=RowCounter%>') in the boeking3.asp page, you are able to get the specific values of that row by using


    <FORM action="boeking3.asp" name="form1">
    <tr><td width='100' align='center'><input type="hidden" name="hdnAction" value='' /><tr>
    repeat


    <tr><td width='140' align='center'><input type="text" name="aantal_r<%=RowCounter %>" /><input type="image" src="images/caddie.gif" onclick="this.form.hdnAction.value='<%=RowCounter%>';" name="B3" > </td></tr>



    until rs.next=0




    </FORM>





    in the boeking3.asp, you should be able to get the desired results


    iRow = request.form("hdnAction")


    iAantalOfRow = request.form("aantal_r" + iRow)





    Success


    --
    Steurm
    www.steurm.net/steurm
    [​IMG]
     
  4. Strange error ...
    It states "Het veld COUNT is onjuist ", however the line of code which generates the error has nothing to do with a field count. Is line 57 the one in blue ?

    Maybe a few remarks:
    • Do you have a field with the name Count ? Because that might cause problems since it is a reserved word. If in your code you want to refer to that field (however it is better to avoid such a field), you should refer to it as [Count].
    • straantal=request.form("aantal_r" + intgetal8): it is better to use a '&amp;' to concatenate the strings to form the name. It probably does not generate the error, but it is better to use a &amp; to concatenate (although + will work)
    • it seems that all yourfields are text-fields ? It might be better to use number-fields for quantities etc.




    --
    Steurm
    www.steurm.net/steurm
    [​IMG]
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page