Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

Form - do nothing

Question posted by: thesti (Member) on May 10th, 2008 04:48 PM
hi,

i have a page with a form that i don't really need the data to be submitted.
so, i don't supply a submit button for the form.

all i need to do is to just validate the data entered by a user. something like "number validation" and etc.. i have a link with onclick javascript to do that.

the problem is that when i press enter while focus is on one of the input control of the form. it seems that it submit the form and the page is refreshed, i don't want this because it reset all the field to empty and the error messages are dissapeared.

how to solve this?

thanks in advance
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
drhowarddrfine's Avatar
drhowarddrfine
Expert
3,978 Posts
May 10th, 2008
07:13 PM
#2

Re: Form - do nothing
In your javascript, I believe you need to finish it with "return 0"

Reply
thesti's Avatar
thesti
Member
56 Posts
May 10th, 2008
10:08 PM
#3

Re: Form - do nothing
hi,

thx for the reply. i've done that, but the page is still refreshed or something.

the value in the fields are gone.

how to make a form, that do nothing (don't submit) when enter is pressed ?

thanks

Reply
thesti's Avatar
thesti
Member
56 Posts
May 11th, 2008
03:20 AM
#4

Re: Form - do nothing
i find out that this behaviour only happens in opera.

so i think this is not a serious issue.
thanks for helping

Reply
Reply
Not the answer you were looking for? Post your question . . .
170,099 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Top HTML / CSS Forum Contributors