Onchange for client script issue

Vishweshwara
Tera Contributor

Hi,

 

Created a simple client script for a return check box at On Change.

its working if i mark it checked, but once i make it uncheck then return date is not getting invisible. Not throwing any error also.

Please assist me.

 

Vishweshwara_0-1726402335351.png

 

 

Regards

Vishwa

2 ACCEPTED SOLUTIONS

Brad Bowman
Mega Patron

Mandatory fields cannot be hidden, so setMandatory false before setVisible false in your condition when the box is unchecked / false.  Also consider using setDisplay in place of setVisible to consume the empty space.  If this is all you are doing in the script, it is recommended to use a UI Policy for these actions.

View solution in original post

Mark Manders
Tera Patron

You have 'newValue === '' ' in your first 'if'. So if it's empty, it returns. 

But why are you using a client script for this? A UI policy is the easiest way to do this, with not necessary scripting.

View solution in original post

2 REPLIES 2

Brad Bowman
Mega Patron

Mandatory fields cannot be hidden, so setMandatory false before setVisible false in your condition when the box is unchecked / false.  Also consider using setDisplay in place of setVisible to consume the empty space.  If this is all you are doing in the script, it is recommended to use a UI Policy for these actions.

Mark Manders
Tera Patron

You have 'newValue === '' ' in your first 'if'. So if it's empty, it returns. 

But why are you using a client script for this? A UI policy is the easiest way to do this, with not necessary scripting.