File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
J P Nelson
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good call.

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

Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic