Page 1 of 1

ajax question - show diferent forms on dropdown select.

Posted: Wed Aug 09, 2006 7:31 pm
by pedrotuga
I have a form that depends on a selection made by the user.

For example, when the user comes he/she can only see a dropdown to choose the continent he/she lives.
Once selected the page should display the rest of the form... like... choosing the country... region, age, profession, etc etc...

this is not the most polite way to ask... but... can somebody post basic code on how to do this?

thanks

Posted: Wed Aug 09, 2006 8:32 pm
by Christopher
That is only an Ajax question if the revealed form fields need to load based on the selection. Otherwise it is simple a matter of using Javascript to set elements to be visible based on a selection. The display Javascript is essentially the same whether Ajax is used or not.

Posted: Wed Aug 09, 2006 8:54 pm
by pedrotuga
yep... the fields are based on the content of the form.

Posted: Wed Aug 09, 2006 10:59 pm
by Christopher
So whether you use Ajax or not depends on whether you want to Lazy Load the data or initialize the page with all the data (you could create Javascript arrays for example). EIther way you do it, the display handling code is the same. And if designed properly, it should not matter where the data comes from so you could switch between Lazy Loaded and initialized data.