PDA

View Full Version : Default button action


edmorey
23-Oct-2003, 09:54 AM
Does anyone have any ideas how I can make the default button within the checkout the "Next" button - rather the first one either "Cancel" or "Previous" depending on which page you are on)?

Where I want to get to is that when customers are filling in the various form fields that they can press either the "Return" or "Enter" key on their keyboard and they are taken to the next step of the process.

Cheers
Ed

Ben
24-Oct-2003, 01:58 PM
Click here (http://community.actinic.com/showthread.php?s=&postid=13011#post13011) for a previous suggestion.

edmorey
24-Oct-2003, 05:32 PM
Thanks for the pointer.

I have already tried the "make the back button a javascript history.go(-1)" idea and found that you get "this page has expired messages" which is no good.

I'd be grateful if anyone has a solution to this...

cdicken
28-Oct-2003, 04:01 PM
The problem is that the '<Back' button is the first <input type="submit"> that the browser comes across - so it uses it as the default.

You need to somehow re-arrange the HTML so NETQUOTEVAR:NEXTBUTTON is the first one. You could always put the buttons one on top of the other or something like that.

edmorey
28-Oct-2003, 04:18 PM
Hi Chris

I was wondering about making the NEXT button the only submit button. CANCEL is not a problem - I could take the visitor to the INDEX.HTML or ACATALOG/INDEX.HTML. The BACK button is more tricky. If I use HISTORY.GO(-1) then I get a "page has expired" message - is there another link that I could use to overcome this?

Ed

rmladden
28-Oct-2003, 04:55 PM
I don't have time to try this, but I would think that javascript can do this by using onsubmit on the form tag. You can check if one of the buttons was pressed. If not, return false.

rmladden
28-Oct-2003, 08:23 PM
I found this javascript:
http://javascript.internet.com/forms/return-key-disable.html

rmladden
29-Oct-2003, 02:49 PM
I added the above javascript to Act_PrimaryCheckout.html and it works perfectly.

edmorey
29-Oct-2003, 06:07 PM
Hi - I must be being thick! :confused:

I don't get how adding the Javascript to check which button is clicked helps me. I am trying to make it appear that NEXT has been clicked when the user hits the RETURN or ENTER key on their keyboard, so that they move to the next screen in the process - rather than the CANCEL or PREVIOUS as happens at the moment. Please explain.

Thanks
Ed

rmladden
29-Oct-2003, 06:19 PM
The script disables the enter key. Even if the next button was the default, people often hit enter when entering text and the form is submitted before it is completely filled out. With this script, they have to click on the button of their choice when they are done.

rmladden
29-Oct-2003, 06:50 PM
You can also write a script that redirects the enter key to clicking the next button, but I like this better.