Back Forum Reply New

form variable depending on button

Heya All,

Okay, I'm looking for the easiest way to add an extra form variable depending on which button was clicked. This is similar requirement to how we pass the particular eventId via the name of the submit button with quot;_eventId_${eventName}quot;.

I could do this with a full link and not use a form button, but it seems more consistent in my application to try and get a button. Javascript is an avenue I'm hoping not to go down... but could be the easiest option.

Cheers,

Dave

why not try a hidden field which you populate using javascript once the button is pressed if that's your thinking. or just use jstl to determine which button to show lt;c:choosegt; or lt;c:ifgt;   etc, this way I'm guessing depending on the fields the user has select certain buttons will be displayed which will have the value you want submitted.

Yeah, I'm thinking Javascript is the way to go here: when the button is pressed then we populate a hidden field like you said. I was hoping to use a mechanism like overloading the name of the button pressed to also have the event, but I think that's a one horse solution and there's already a rider.

Ok,  coz  it seems that  to dynamically populate the event Id (quot;_eventId_${eventName}quot;.) you need to be able read the field first either from the session then add it in or get it using a javascript onsubmit /onclick etc.  hope that helps.
¥
Back Forum Reply New