• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Two Submit buttons in JSP Page

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 129
Firefox Browser Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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



 
Sheriff
Posts: 67753
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nothing to do with JSP. Moved to the HTML forum.
 
Amateurs built google. Professionals built the titanic. We can't find the guy that built this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic