Reply LinkBack Thread Tools Search this Thread
Old 14-08-2007, 09:43   #1 (permalink)
freelancr
Senior Member
 
freelancr's Avatar
 
Join Date: Oct 2006
Posts: 2,097
Multiple Submit Buttons for a single form.

Just a quick one. I have used mutiple input buttons for a single form, if a user presses "enter" it seems to activate the first submit button in the source code. Is there any way of setting which button is the primary submit button, allowing it to be activated when the user hits their "enter" key?
  Reply With Quote
Old 14-08-2007, 11:37   #2 (permalink)
weldo
now with added beard
 
weldo's Avatar
 
Join Date: Mar 2004
Location: Liverpool
Posts: 5,273
tabindex ?
__________________
fuck signatures
  Reply With Quote
Old 14-08-2007, 11:52   #3 (permalink)
mx
fucksocks™
 
mx's Avatar
 
Join Date: Jun 2005
Location: in the boosh
Posts: 1,615
why have you got multiple inputs?
__________________
  Reply With Quote
Old 14-08-2007, 12:17   #4 (permalink)
djeglin
goober :-)
 
djeglin's Avatar
 
Join Date: Dec 2006
Location: Birmingham, UK
Posts: 525
Send a message via MSN to djeglin
surely if you have multiple submit buttons, but within a single form, both buttons must do exactly the same thing anyway? All they do is submit the values of the form fields and the form action dictates the rest... Unless you've got some other funky stuff going on in there... ?
__________________
My signature sucks.
  Reply With Quote
Old 14-08-2007, 12:42   #5 (permalink)
freelancr
Senior Member
 
freelancr's Avatar
 
Join Date: Oct 2006
Posts: 2,097
On a course booking page I have 2 buttons, back and next. This allows them to select a course, then a location, then a date, then how many places, then enter candidate names. I solved this problem by putting the "next" button in the xhtml first, and using css to float them.

But on my shopping cart page, I have a image input delete button and a quantity box for each item. I have a "refresh" button at the bottom of the cart which when pressed will update the cart with any changed quantities. I also have "next" button which proceeds onto the next step of the order.

Ideally I would like the "refresh" button to be the one to react to the user hitting the enter button, incase someone changes a quantity and hits enter. But at the moment it seems the first delete button on the page gets submitted by hitting return.

I am using PHP to determine which button has been pressed. For example:

PHP Code:
if (isset($_POST['btnRefresh']))
{
    
// recalculate cart
}
else if (isset(
$_POST['btnNext']))
{
    
// go to step 2 of the order process
}

// display cart 
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8