tags:

views:

39

answers:

2

Hey, so my form is where you register you as a user. You type in 2 fields then press next and then 3 new fields come and then it runs the action="index.php?register=yes".

Now as you can see i highlighted "then press next" thats because, maybe some users just press enter after typing in the last field, and then it runs the action. But if you click Next, it shows you the 3 new fields(fading them in with javascript) and i added a return false; so it doesnt run the action="" in the form until the last button(on "page 2(with the 3 new fields")

Is there any way to do so you can "return false" if you just press enter(on your keyboard), like you can return false when you click on the button so it dont run the action="" ?

A: 

Just replace

<input type="submit">

with

<input type="button">.

It will still look like a submit button, but it won't try to do the action.

codersarepeople
That is not what i am looking for. Im talking about if you are inside a field like this comment box im typing in, and then you press ENTER on your keyboard, then it goes to action=
Karem
A: 

You just attach a function() { return false; }" on the onSubmit event of your form when you display page 1 or 2 (you can even do a function to go to the next page), and you do a return true when you're displaying page 3.

Ugo Méda