• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Form submit

 
Andy Hahn
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have a question on submitting a form in a JSP. I have a form that contains 2 submit buttons and a text field. If a user enters a value in the text field and then presses the Enter button on the keyboard, the form should get submitted. My question is which submit is used since there are two buttons? Does the first submit button get used? Can I set a default submit button?

Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65128
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing to do with JSP per se. Moved to the HTML/Javascript forum.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65128
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why two submit buttons? If only one is to have submit semantics, make it the submit button and leave the other without submit behavior.
 
Andy Hahn
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good question. It is because we are using a third party vendor's tool which abstracts all of the Form and form elements. For example, instead of being able to code a submit or plain button input, we use a graphical widget to drop a button into a template. The button widget is always of type "submit". I have to use a "View Source" in order to see the actual html that gets produced.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65128
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When a tool creates more problems than it solves ...

If there's no way to control it, you may just have to try it out and see how it works for you. Be aware that the behavior may be browser-specific.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic