HowTo set the default submit button on a form
Howard has a nice little trick for setting the default submit button on a form. Basically, you just put the default button first, and then use style="display: none" to hide it. For the most part, I haven't had any issues with putting the default submit button first (i.e. "Save"), but I have noticed an issue when developing wizards (b/c "« Previous" is likely to be first). Nice tip Howard.
Posted by will budreau on May 06, 2006 at 12:00 AM MDT #
This didn't work for me in internet explorer 6.
I used a div with style="display: none" and that worked.
Posted by boris on August 17, 2007 at 12:58 PM MDT #
Posted by pederbl on April 18, 2008 at 11:13 PM MDT #
Posted by brt on June 12, 2009 at 12:38 AM MDT #
Posted by m_rahman on January 04, 2010 at 06:15 PM MST #
What about this:
This puts the submit buttons in the right order so that 'Next' is the default button, but displays them on the page in the opposite order.
Posted by Splat on October 13, 2010 at 06:20 AM MDT #
Another simple trick
ie 7 and abovecreate the other button as a type="button" the second can be type="submit"
Something like
Posted by Mantramix on January 18, 2011 at 08:32 AM MST #