Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Two Submit buttons in JSP Page

 
krishna Mohan Athota
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have one JSP Page with
One Edit Box
Two Submit buttons "Button #1", "Button#2"

If i hit the "Enter" key in keyboard, "Button #1" should fire.
If i keep a cursor pointer in text box, and hit the "Enter" key then "Button #2" should fire.

Can anyone help me different approaches to achieve this solution?

Thank you
Krishna Mohan
 
Dawn Charangat
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On the text box's onkeypress event, add a javascript method to trigger the second submit button. I guess that should do it.
 
vijin das
Ranch Hand
Posts: 129
Firefox Browser Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
krishna Mohan Athota wrote:Hi,

I have one JSP Page with
One Edit Box
Two Submit buttons "Button #1", "Button#2"

If i hit the "Enter" key in keyboard, "Button #1" should fire.
If i keep a cursor pointer in text box, and hit the "Enter" key then "Button #2" should fire.

Can anyone help me different approaches to achieve this solution?

Thank you
Krishna Mohan


How many text boxes you are having ....... the only way you can do it through triggering a JavaScript function when you keep the cursor pointer in text box .in that function set a Boolean then when you press Enter call another JavaScript function which will check the boolean value .... using document.formname.submit(); to submit inside that to submit the page.........

you can check the links for reference ....boolean



 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64967
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing to do with JSP. Moved to the HTML forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic