Reputation: 19
I'm trying to create a dependent select form like this one on AjaxRay. Here's what I've done so far: http://buzzmedia.com.my/honda/form.html
Unlike the example from AjaxRay, my form has multiple rows. I need to figure out how to adapt the code from the AjaxRay example for my own form.
Upvotes: 0
Views: 1172
Reputation: 94
I think you would enjoy writing your own jQuery code... If number of options is limited (under ~500) Then I think you should put them in an array.. otherwise you should use AJAX to query it dynamically as JSON..
lets say they are limited number.. A hierarchy array like this should do it..
var ops = [
{'txt':'Accord'
,'val':1
,'ops': [
{'txt':'VTi','val':101}
,{'txt':'VTi 2.3','val':102}
,......
]}
,
{'txt':'City'
,'val':2
,'ops':[
{'txt':'1.5 i-DSI','val':201}
,{'txt':'1.5 Vtec','val':202}
,......
]}
,......
];
then you can populate all select boxes from that array.. and add on-change handler function on the parent box with the id of the child box.. ID's can be On change of the parent box you get $(this).val() and scan the array for it to populate the child box...
Hope that helps..
Upvotes: 1