Hiding field value dependent on another field value

jas101
Tera Expert

Hi guys,

 

I have created a UI policy to hide (stop a value from being selected) on a field called 'Subtype' e.g. value 'Minor' when the value of 'Domain' field is e.g. 'Deacons' - while this works if the Domain chosen initially is 'Deacons' if it is then changed, the 'Minor' Subtype value is still unselectable (when it should be selectable). Likewise if I choose another Domain initially and set the Subtype as 'Minor' I can then change the Domain value to 'Deacons' - meaning the Subtype value which should not be selectable is!

ui policy hiding minor subtype.PNG

 

I think this is because I have it onLoad in the UI Policy - in which case I need it more dynamic, i.e. whenever the value of Domain field changes, do I therefore need a client script instead?

 

Another option would be to force the value of Subtype to always be 'Standard' when the Domain is 'Deacons' but I'm unsure what is easier.

 

Any/all help much appreciated as always.


Cheers,

Daniel

1 ACCEPTED SOLUTION

whatever value you want to set use the below line in 'execute if true' and 'execute if false' section,



g_form.setValue('subtypeVariableName','whateverValueNeeded');



place this as the last line in the corresponding sections


View solution in original post

15 REPLIES 15

remove option is greyed ? guess you must be using chrome


So one thing you might have missed is 'Reverse if false'. Set it to true


Setting 'Reverse if false' to true has helped somewhat however the only issue now remaining is if I choose a domain that IS NOT 'Deacons' obviously all options are available for Subtype, so I can then choose 'Minor'. However if I then change Domain to 'Deacons' the Subtype value remains as 'Minor' - i.e. ideally this would force to None or just the other value 'Standard'. Any thoughts?



We use both Chrome and IE here.



Thanks a lot,


Daniel


whatever value you want to set use the below line in 'execute if true' and 'execute if false' section,



g_form.setValue('subtypeVariableName','whateverValueNeeded');



place this as the last line in the corresponding sections


Great, it's working as hoped.



Many thanks Kalai, and everyone else for your input.


Hello


I get an error message 'Error MessageonChange script error: TypeError: g_form.setvalue is not a function function (){var o=i(m,arguments);return l.apply(n,o)}'


Would you happen to know why g_form.setvalue is not a function?