I want to be able to filter a valuelist based on the selection of another valuelist. I’m using the svy_utl_valuelists module for these valuelists because they have to be i18n based.
I think i have to modify this module to be able to do what i want with my valuelists, Parent and Child:
-
I need in the child valuelist a field to set for each value which parent value it is linked to.
-
I need to update the filter when the user selects a new parent value
-
Add a extra field to vlt_valuelistvalues to store the parentid, modify the form to enter this parent id
-
Use onChange event of the Parent field?
Am i correct in doing it this way? Or is there another (better) way to do what i want?
Jos.
First valuelist can be a table valuelist.
Second (child) valuelist should be a related valuelist, based on a relation parent table_to_child table .
DOing this way, you do not need to program anything in onDataChange .
We have used it vastly with no problem.
Some more info about my previous post :
achiary:
First valuelist can be a table valuelist.
Second (child) valuelist should be a related valuelist, based on a relation parent table_to_child table .
DOing this way, you do not need to program anything in onDataChange .
We have used it vastly with no problem.
First valuelist can be a table valuelist. For instance countries, with pk = country_id .
Second (child) valuelist should be a related valuelist, based on a relation where :
- source is :
either country_id in the table of the form theet is being updated (no onDataChange programming needed)
or a global variable (i.e. globals.country_id) filled programatically in onDataChange of the country field
- destination is :child table , for instance cities, with pk = city_id and contains country_id
Hope this helps.
Hi achiary,
How would this work with i18n values? It was my understanding that in the solution you suggest it would not be possible to use i18n based values in the value lists.
jdbruijn:
Use onChange event of the Parent field?
Using onDataChange event could be useful, but be aware this solution has limited use.
When you can’t be sure the conditional valuelist has absolute unique return values, this solution can’t be used to display the valuelist in a table view situation.
As Achiary already mentioned a relation would do a better job here.
jdbruijn:
How would this work with i18n values?
as far as I know in the original svy_utl_valuelists module the translations aren’t i18n either.
This is understandable as valuelists are customer-specific and therefore these values are entered by the customer.
So if you want the conditional lists to work as the original module, I guess you have to stick to the same structure.