Forums

How can I add a simple Double Drop-Down without Ajax?

clovismmbr 30 Jan, 2014
Hello, i get successful using the instructions in the FAQ with the same name of this post.
But when i try to load data from DB i stuck.

The faq could be some like How can I add a simple Double Drop-Down without Ajax loading data from DB?
I have two tables named: ##__tb_state and ##__tb_city

The tb_state fields are:
id << for state id - PK
uf << for state code
name << for state name

The tb_city fields are:
id << for city id - PK
state << state id - FK
uf << state code
name << city name

I have two dropdowns fields (State and City) loading the values from db

I want select in my dropdown state the state name and load only the city names of that state into city dropdown

Could any one to show me a step by step for this specific situation?
I have tried to adapt the FAQ's and posts in forum but i got confused
I purchase the Chronoforms book but i cant adapt to CFV4 because the book was written for CFV3
Im not a programmer but i try to learn with others in the forum

I dont know how to link the two DB Multi Record Loader action to work with dropdowns fields
Do I have to use Dynamic Dropdown Action also?
Im lost, Please help
Sorry about my poor english

If you need i can upload the form and the sql w/ two tables

Clovis
GreyHead 30 Jan, 2014
Answer
Hi Clovis,

I don't understand what you are trying to do. Unless your state and city lists are very short then it's usually easier and tidier to create them with Ajax.

If you want to create a double drop-down without Ajax then you can use two DB Multi-Record Loaders to get the data and then process it into option lists using PHP.

But it is much simpler to use the Ajax method.

Bob
clovismmbr 30 Jan, 2014
Hello Bob, Thanks for reply

My city table have more than 9000 cities i don know if is long or short number of records

I dont know how to use ajax😟 without a step-by-step. Please help.

But also would be nice to learn how to link two DB Multi Record Loader action and then load data into double dropdown

Its too hard? link two DB Multi Record Loader action and then load data into double dropdown? cause i am not a programmer

Out of Topic: Do you have something about to write a new book of CFV4 actions?
GreyHead 30 Jan, 2014
Hi Clovis,

If you have 9000 names the use Ajax, see this FAQ and scroll down.

There are no plans for another book at the moment - but I have written about a book full of CFv4 FA Qs now. We'll see what happens with v5.

Bob
clovismmbr 01 Feb, 2014
Great Grey Head!
I just did it to work like a charm using your Faq : How do I build a select drop-down, radio button or checkbox group?

Now i have two dropdowns linked first one have states from DB and second one have the cities

Thank You very very much!
clovismmbr 01 Feb, 2014
Hello Grey Head, now i have another issue. I need do handle arrays to save in DB table, Email and thank you page.
Ass you can see the arrays of dropdowns brings only the values.

Endereço:*	 Rua Dr. Renato Paes de Barros 714 - 74
Bairro:*	 Itaim Bibi
Complemento:	
Estado:*	 15  <<<<<<<<<<<<<<<<<<< THIS IS THE VALUE FOR DRPODOWN ESTADO (means state)
Cidade:*	 15 <<<<<<<<<<<<<<<<<<< THIS IS THE VALUE FOR DRPODOWN  CIDADES (means cities)
CEP:*	 04530-001 


Im using DB Multi Record Loader actions to load cities and states and works fine
I put the Handle Arrays action on top of submit event.and i put Show Thanks Message Action just below

What else i can do?
clovismmbr 01 Feb, 2014
I forgot to put the form URL: http://hdibrasil.com.br/hdibrasil/index.php?option=com_chronoforms&chronoform=membership&tmpl=component&lang=pt-BR
clovismmbr 12 Feb, 2014
Im still confuse, but must be cause my english and programing skills is too low.
But i did not give up, i wll read the faq again to see where im wrong
This topic is locked and no more replies can be posted.