Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to set a form value programatically on PIE

 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Pauline McNamara
Sheriff
Posts: 4012
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it OK to have 2 submit buttons for one form?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic