Spring Form: Submitting extra parameter on submit buttons
Posted
by theringostarrs
on Stack Overflow
See other posts from Stack Overflow
or by theringostarrs
Published on 2009-12-10T20:58:27Z
Indexed on
2010/05/07
17:38 UTC
Read the original article
Hit count: 244
Hi,
I am working on a form with a bunch of selection criteria that will generate a report when the form is submitted. I also have a number of different reports that can be generated form this same criteria, and want the type of report to be selectable by using a tab system where each tab clicked on submits the form and generates the correct report. I was to do this by passing an extra parameter into the form to switch onto the right form type
I am new to Spring, and from the guidance of an elder was told to use an input button for each tab with the following approximate syntax:
<input type="submit" name="${form.selectionValues.tabSelection}" value="1" />
tabSelection form property of the SelectionValues object is not being set. I wasn't surprised ;) DIdn't think this would work.
So I am wondering how can I can submit a post back from a button in Spring containing the form values plus an extra tabSelection parameter and value? How should I mark up this mechanism? Will I have to do anything to the form controller to register this extra parameter?
The original markup I was using to build this page, was using HTML anchor tags instead of buttons for the tab links, which would be much better for the CSS, is there any way to trigger a full form submit using an anchor href? I know this will be a GET request instead of a POST, and not associated with the form.. so I dont expect this to work.. just trying to think of solutions! I would prefer to use the priginal markup, as the styles are there.
Any help would be appreciated
© Stack Overflow or respective owner