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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enter key posts empty form

Status
Not open for further replies.

Esoteric

ISP
Feb 10, 2001
93
US
I have a shopping cart that works great with one small exception. When you change the QTY and press enter the form executes with no valid data so it spits back NO Quantity entered.

I read this is a buggy thing and if I have (2) text fields it works without flaw but I don't need (2) I only need one.

CODE SAMPLE -----------------------------------------
<form action=updatecart.asp method=post>
<input type=text name=QTY size=1 value=<%=rs(&quot;QTY&quot;)%>>
<input type=hidden name=CARTID value=<%=rs(&quot;CARTID&quot;%>>
<input type=submit name=Update value=Update>
</form>

I read to use the onSubmit = &quot;return false&quot; to disable the enter key and that does work but then my form breaks.

I need to use the onClick = formname.submit() I think but I can't seem to get the specifics on the use of that event.
 
Hi there

I have actually just been dealing with a similar problem myself.

I'm a little unclear exactly what you are trying to do here. You have a form with a RS quantity showing that the user updates and submits to an asp/sql query right? A little more code would probably help.

Things I would suggest however are:

checking the info actually being passed are you getting a single value(the new qty) or a string(old and new combined)

is your update query syntax ok

can you update other fields ok


Well I hope this is some help

Justin.X-) &quot;Creativity is the ability to introduce order into the randomness of nature.&quot; Eric Hoffer

Visit me at
 
Yes Justin I am using a recordset, I have a lot of sites using this shopping cart and everything works fine, one of the sites is done a lot of business and its working great the only thing is they want to improve its ease of use.

Currently if the customer WACKS that enter key it just tells them HEY you need to use the UPDATE button. Kind of a pain to explain to a business owner why its doing that.

Looking for answers.
This web site explains my issue.
 
You can use the onSubmit return false in the <FORM> tag to keep the enter key not working. It works better if you have a blank function that just returns false though, sometimes it has problems without a function i.e. onSubmit(&quot;return callFunction();&quot;) where callFunction just returns false.

You can use the onClick() event, but you don't put it in your <FORM> tag. You have to put it in your <INPUT TYPE=BUTTON onSubmit(&quot;&quot;) NAME=&quot;btnSubmit&quot; VALUE=&quot;SUBMIT&quot;> like so. Putting an onClick() in the <FORM> tag does nothing that I know of.

Hope this helps you. Harold Blackorby
hblackorby@scoreinteractive.com
St. Louis, MO
 
Oops. I ment onClick in the button code, not onSubmit. Harold Blackorby
hblackorby@scoreinteractive.com
St. Louis, MO
 
I really need this to work and I am still unable

Here is my code:
<tr bgcolor=eeeeee>
<form action=updatecart.asp method=post submit=&quot;return false&quot;>
<td align=right valign=top><input type=text size=1 name=QTY value=<%=rs2(&quot;CartQty&quot;)%>></td>
<td valign=top><%=rs2(&quot;ITEM&quot;)%></td>
<td valign=top><%=rs2(&quot;ITMGRP1&quot;)%></td>
<td valign=top align=right><%=rs2(&quot;PACK_SIZE&quot;)%></td>
<td valign=top align=right><%=formatcurrency(cost,2)%></td>
<td align=center>
<input type=hidden name=CARTID value=<%=rs2(&quot;CARTID&quot;)%>>
<input type=hidden name=CSV value=<%=Request(&quot;CSV&quot;)%>>
<input type=button onclick(&quot;&quot;) name=btnSubmit value=&quot;Submit&quot; style=&quot;width:80;&quot;>
<br>
<input type=submit name=Delete value=&quot;Delete&quot; style=&quot;width:80;&quot;></td></form>
</tr>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top