Forums

AJAX Dropdown depending on two Dropdowns

fsenn 11 May, 2015
Hey guys,

I'm not able to resolve the following problem:

db_table1 with columns value_dropdown1 and text_dropdown1

db_table2 with columns value_dropdown2 and text_dropdown2

db_table3 with columns value_dropdown3 and text_dropdown3 and value_dropdown1 and value_dropdown2

There are 3 Dropdowns:

First and Second: Dynamic data from DB_read on table1 and table2

Third: Dynamic data from AJAX loader and DB_Read on table3

The data for dropdown3 should depend on the selection made on dropdown1 and dropdown2.

I want to load all id_dropdown3=value_dropdown3 with matching id_dropdown1 AND id_dropdown2.

At the moment, I followed the tutorial How do I build a Double Drop-down in CFv5 and on the DB_read on table3 I've got the condition:

<?php
return array( 'value_dropdown1' => $form->data['dropdown1']);
?> 


How can I integrate value_dropdown2?

Thanks for your patience!
Max_admin 12 May, 2015
Hi fsenn,

When the AJAX is executed, it sends the data of all the form fields, so you can add an event to the 2nd dropdown to load the options of dropdown 3, and you can reference the 1st and 2nd dropdowns values in the php code, e.g:

<?php
return array('value_dropdown1' => $form->data['dropdown1'], 'value_dropdown2' => $form->data['dropdown2']);
?> 


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
rocteste 28 Jul, 2015
Hi,

I followed the text "How do I build a Double Drop-down in CFv5". My first dropdown is reading a table and the second one should only show one option.
It shows all the time the fist line of the table. Every time a check a different option on the fist dropdown menu it appears to reload the code but changes nothing.
I appreciate any help.
Best regards,

Thank you in advance,

João Rocha
Max_admin 11 Oct, 2015
Hi João,

Then your "db read" settings in the ajax event must be wrong.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.