I have worked through how to use Behaviours to update a select list options at form initialization. I think that there should be a way to update the select list options based on a change to another field on the screen. I think that this should be part of a condition, but I can't figure out how this gets configured in the Behaviour module.
Hello,
Let s say you have two fields: "Parent field", "Child field". You have to create a behaviour and add "Parent Field" to the behaviour. Then you should add a script to the "Parent Field" (it is important to add the script to the Parent Field not to the behaviour as you did before).
You script would look like this
def parentField = getFieldByName("Parent Field")
def childField = getFieldByName("Child Field")
if (parentField.getValue().equals("1"))
{ chilField.setFormValue("my value")}
I did not check the script but that is the idea how it should work. If you have any further questions, do not hesitate to ask.
Great - you answered my question. It is not clear from the documentation (or I just did read it closely enough) that the behaviour of the field is triggered on the change to the field. Now that I see it, it becomes pretty obvious.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello, could you please clarify what it mean "add script to the field not to the behaviour"? You mean to field description?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alexey, your solution works on the editing page, the child field updated while changing the parent.
But I found it do not work on the creating dialog. It is the popup window when creating. After the parent field was changed, the child field is expected to be updated. The script seems do not work on this window. Do you have any idea? Thank you any way.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.