Multiple submit buttons with specific event associated

markus77 10 Dec, 2012
My aim is :
- one drop down box
- one text area displaying the result of the item chosen
- one button "browse" and one button "modify"

Is it possible to affect a event to "browse" button (dbload) and a different one for "modify" button (dbsave) depending on the clicked button ?

subsidiary question 🙄 : is it possible to have text area updated by selecting item in drop down without having submitted ?

Many thanks.
GreyHead 10 Dec, 2012
Hi Markus,

Yes, to both questions.

You can have two (or more) submit buttons in your form with the same name and different values; check the value when the form is submitted to see which one was clicked. Please see this FAQ for ways to conditionally run an action.

The text are one probably requires some JavaScript. What do you want to show in the text area and where does it come from?

Bob
markus77 11 Dec, 2012
thank you for your reply !

to illustrate : the drop down list contains categories of athletics records of my club (let's say 10000m). These records are stored in a database. So when i select an entry (eg 10000m), i'd like the text area showing the 10000m records stored in database (dbload event)without having clicking "browse button". If this is possible, i don't need the "browse" no more, but only the "update" button if needed.
GreyHead 11 Dec, 2012
Hi Markus,

I think that Petasis' Ajax enabled drop-down will do pretty much exactly what you need. He modified the standard double drop-down so that you can insert the results into any other element on the page. I don't think I've tried it with a text area but I think it will work. It would certainly allow you to show the info in a div or span.

Bob
markus77 18 Dec, 2012
Thank you, it works ! I finally created 3 buttons with 3 events ("browse","modify","XLS Export").
This topic is locked and no more replies can be posted.