Forums

A form with 2 select & no submit?

petasis 14 Jan, 2012
Hi all,

I want to create a "form", that will allow me to select an "article" and show it on a page.
(I am using Chronoforms 4)

Until now, I have created a form with two select comboboxes.
The first select, has a set of predefined entries (sources). When the user selects a value, the values of the second form change according to the selection (I have added a "Dynamic Dropdown - OnChange", which calls a custom event, which queries the database and returns the appropriated values for the second combobox).

The form can be seen here: http://www.ellogon.org/itest/index.php/el/proionta/dokimastikes-ekdoseis/opinionbuster-el

My question is: how to proceed?
I want when the selection changes in the second select, to have a second AJAX event to the database, and show the results of the query below the form.

Is there a "recommended" way to do it?
(Something like the "dynamic dropdown", but fill a div instead of a select input...)
GreyHead 15 Jan, 2012
Hi petasis,

There's no recommended way to do it. A second Ajax inquiry is probably the way that I would go. You'll need to modify the code for the second Ajax event to look up the article details in the #_content table and return a chunk of HTML that you can inject into the page.

Bob
petasis 15 Jan, 2012
Is there something I can add in the events section of the wizard, that will trigger the second ajax call?
(For the first select, I have added a "dynamic dropdown - on change" in the on load event.
This inserted some javascript in the page, that calls the ajax event I have created.
What can I add in the second select to do the same? (But not interpret the results as the values of a select, separated by "=").
petasis 15 Jan, 2012
Finally, I created a new form action (in the administrator component), that is a slight variation of the "dynamic dropdown", which always calls a form event and simple inserts the results of the query to the target id.

It was not that difficult, its easy to add form actions.

But I have a second question:
When the first dropdown is called, it triggers the "change" event on the target dropdown.
Is there a way to select its first option?
GreyHead 15 Jan, 2012
Hi petasis ,

Sorry, I've never used Max's dynamic dropdown action so you now know more about it than I do :-)

Bob

PS If you send me your new action I'll publish it for other users.
petasis 15 Jan, 2012
I have sent you a PM with a link to the archive of my new form action.
This topic is locked and no more replies can be posted.