July 01, 2008, 02:33 AM
PeteChained Comboboxes - setting defaults ....
Hi All,
I've been exploring how to chain comboboxes via the xml/pchold method, and all the examples on here have been a great help.
Let's say that i have 3 chained combo's
- Country
- Car
- Model
Normal behavior is that when country is changed car and model are populated with those items that belong to the choosen country
But how can i do :
When Model is changed , i would like to see that car and country are set to the defaults to which model belongs
ex.
when the model is changed to value V12XKE AUTO
Country should be put on default Engeland
Car should be put on default Jaguar
How should i go about this?
P.
July 01, 2008, 05:44 AM
Tony APete,
You are talking reverse chaining which you would have to code completely yourself in JavaScript unless you can utilise the existing function "populateDynamicCtrl(ctrl)" within the ibirls2.js.
You would have to ensure each of your population fexes has a variable test for each combobox that you want to utilise.
Good luck
T
July 01, 2008, 06:12 AM
PeteHi Tony,
But i dont want to repopulate them , just select the right parent (or doesn't that make any difference)
P.
July 01, 2008, 06:59 AM
Tony APete,
When your launch page loads, a sequence of JavaScript calls are made that build the contents of your chained combo boxes in the order that you chain them. When this JS is executed it replaces the onChange event call for each of your combo box(es) with a call to populate the dynamic control(s). The first combo is populated, then the second etc. This is where your requirement would fall down.
The reason being that the onChange event would be triggered everytime you made a change to a predecessor combo in your chain and the whole event would ripple through the JS again, removing any selection that your user had made in the final combo.
E.g. with no selection in the first two combos and a selection of a model in the third. You trigger the update process and locate the country relevant to your selection and apply that change to the first combo. Note: A
change to the first combo. The onchange event would now be triggered and the selction in the first combo would be cascaded down through your chain, reseting the selectedindex of each subordinate combo to 0 - thus your model selection would be lost.
Hope this explains it OK.
T