How to edit depending fields in a unique form
Archived from the Xataface Users forum.
xenajo — Thu May 19, 2011 7:43 am
I need to edit 4 fields in a form as describe below :
id_level2 depending of the value of id_level1,id_level3 depending of the value of id_level2,id_level4 depending of the value of id_level3
in other words, i would like to select the child of his parent, and this 3 times in the same form
extract from fieds.ini :
[id_level1]
widget:label=”level1”
widget:type = select
vocabulary = listelevel1
[id_level2]
widget:label=”level2”
widget:type = lookup
widget:filters:id_parent_level=$id_level1
[id_level3]
widget:label=”level3”
widget:type = lookup
widget:filters:id_parent_level=$id_level2
[id_level4]
widget:label=”level4”
widget:type = lookup
widget:filters:id_parent_level=$id_level3
but it doesn’t work !
how can i do this ?
thanks for your help
shannah — Thu May 19, 2011 9:04 am
Unfortunately filters are currently very limited, static, and handled server-side so you can’t currently do it this way. This is currently kind of a tricky thing to do. You would need to use some custom javascript.
I recall at least 3 or 4 threads in the forum where people discuss this and there are a few different solutions. All require some custom javascript right now.
-Steve
shannah — Thu May 19, 2011 10:22 am
Actually, I like the syntax you used in your fields.ini file for this. As it wasn’t hard to add support for this in the lookup widget, I have made some changes in SVN to support what you were trying to do.
You would need to update the files
HTML/QuickForm/lookup.php
js/RecordBrowser/RecordBrowser.js
from SVN
http://weblite.ca/svn/dataface/core/tru … lookup.php
http://weblite.ca/svn/dataface/core/tru … Browser.js
-Steve