I have many situations like this in my application. This is what I have
done. Have a hidden field at the top of the form as 'btnpressed' and on
onclick event of each of the buttons, set a unique value to the hidden field
("this.form.btnpressed.value='value1'"). In your action, check the value of
the formbean property 'btnpressed' value and do processing accordingly.

Vijaya

-----Original Message-----
From: Thomas Sundberg [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 26, 2005 8:23 PM
To: 'Struts Users Mailing List'
Subject: Which button was pressed?


Hi!

I have a form where a user should be able to request a report. The user
enters two dates and then presses either a button labeled pdf, html och csv.
How can I read in my action which button was pressed?

My form looks something like this:

The button part of my form looks something like this:

<html:submit value="pdf"
               alt="Create a pdf file"/>
<html:submit value="html"
               alt="View report as html online"/>
<html:submit value="csv"
               alt="Create a tab separated text file for import in Excel"/>

I haven't seen any good examples when looking in the docs and searching the
web. I assume I wan't to add something to the html:submit, perhaps use the
property tag(?), or can I be able to read the value of the button pressed?
How do I read the value in my action?

/Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to