File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Submitting with Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Submitting with "Enter" from textbox where there are several submit buttons on form" Watch "Submitting with "Enter" from textbox where there are several submit buttons on form" New topic
Author

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

J P Nelson
Greenhorn

Joined: Dec 16, 2004
Posts: 12
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Dec 16, 2004
Posts: 12
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
 
subject: Submitting with "Enter" from textbox where there are several submit buttons on form