wood burning stoves*
The moose likes HTML, CSS and JavaScript and the fly likes how to set a form value programatically on PIE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to set a form value programatically on PIE" Watch "how to set a form value programatically on PIE" New topic
Author

how to set a form value programatically on PIE

Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
I've been tasked to create a (smallish) JSP/servlet application to run targetted on iPaqs (thus in PDA).
So far it's going decently well, but I'm running into a problem with some pages that need to send html forms back to the server from different buttons (with different actions being executed based on the button pressed).
For example, the code (JSP) I have so far is as follows (irrelevant stuff removed for brevity):

The onclick (put in a _ to please the forum engine) events don't seem to set the form element value clicking the buttons, the expected actions aren't executed (one would set some data on the server and return to this page, the other set the data and forward to another page).
Any idea what I'm doing wrong here? It works fine in IE6 (the only access to a PDA to test on is one that someone else in the company has which I can have a look at a few times a day, still fighting to get one on my workstation).


42
Pauline McNamara
Sheriff

Joined: Jan 19, 2001
Posts: 4012
    
    6
Is it OK to have 2 submit buttons for one form?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
you might want to try to use regular buttons instead of submit buttons; and call the form to be submitted:
document.formName.submit();
Not sure if that will work or not.
Eric
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
I mapped the submits into the request, giving them all the same name attribute.
On the server I can now just check that attribute and get the value of the button clicked (thus identifying it).
Thinking of putting the button texts in a ResourceBundle to recover the complete separation of display code and logic code...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to set a form value programatically on PIE