• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Submitting with "Enter" from textbox where there are several submit buttons on form

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have a form that has several submit buttons, each with a different name. My JSP code uses the name to figure out how to process the forms. The forms basically allow the user to page through a list of data.

On each form, I have a textbox associated with a submit button that allows the user to jump to a specific page in the data, the page is specified by the value entered in the text box.

My users want to enter the page number in the text field and then hit the Enter key to submit it. I've found out how to capture the key press and see that it is the enter key that was pressed (keyPress == 13...).

If its the enter key, I can call submit, but is there then a way to fool the application into thinking that the corresponding submit button was pressed? Is there a way to set a request paramater associated with the submit action?

Thanks,

Joe
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can try document.forms[0].buttonName.click();

(Not supported in every browser, but it will help)

Other solution would be to set a hidden field on the page with the "string" you are looking for.

Eric
 
J P Nelson
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good call.

I'm having to get the element indirectly, but the idea is what I needed.

Thanks!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic