I have got a form with two selectboxes which I want to populate from database.
These are my database tables:
I want to populate the first selectbox with table "sort".
That's no problem.
After selecting a option from selectbox "sort" I want to dynamicly load the related values from table "answer" in the second selectbox.
Is this possible? And if so, how?
Thank you!
These are my database tables:
TABLE sort
ID | TITLE
1| vegetables
2| fruits
3| drinks
TABLE answer
ID | PARENT | TITLE
1 | 1 | tomatoes
2 | 1 | carrots
3 | 2 | apple
4 | 2 | banana
5 | 2 | peach
6 | 3 | beer
7 | 3 | wine
I want to populate the first selectbox with table "sort".
That's no problem.
After selecting a option from selectbox "sort" I want to dynamicly load the related values from table "answer" in the second selectbox.
Is this possible? And if so, how?
Thank you!
Hi bpluijms,
There are a couple of ways to do this. If the secondary tables are short you can load them all into the Form HTML and hide the and reveal blocks with JavaScript (there may be some validation problems with this approach).
Or if the tables are longer you can load them using Ajax to get the required data from your server (usually through a database query). There's a ChronoForms Ajax tutorial url=http://greyhead.net/how-to-docs/chronoforms-double-drop-down-with-ajax]here[/url] that you can get for just $3. The tutorial is for a "double drop-down" but can be adapted to present the data in other ways.
Bob
There are a couple of ways to do this. If the secondary tables are short you can load them all into the Form HTML and hide the and reveal blocks with JavaScript (there may be some validation problems with this approach).
Or if the tables are longer you can load them using Ajax to get the required data from your server (usually through a database query). There's a ChronoForms Ajax tutorial url=http://greyhead.net/how-to-docs/chronoforms-double-drop-down-with-ajax]here[/url] that you can get for just $3. The tutorial is for a "double drop-down" but can be adapted to present the data in other ways.
Bob
This topic is locked and no more replies can be posted.