Reload a form when field value changes from No to Yes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2022 12:14 AM
Hi,
We have a requirement where we need to make rest other fields disabled when in particular field(Yes/No field) value is selected as "No". Written a onChange client script for this which is working.
Here we need to Reload the form when user changes the value from "No" to "Yes". Can I know which script should be added for this.
note: when "Yes" is selected initially form should work normally.(no need to disable fields /reload form)
Thanks in advance!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2022 04:43 AM
To check the conflict, add alert in your if else condition just before reload statement to check whether its working or not
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2022 06:45 AM
Got the solution..
It does not return oldValue, which we have set as No.
Just got to know oldValue is nothing but the value of the field when the form loaded and prior to the change.
So we created one variable(reload_form) which will be hidden on form. And have set value as 'No'.
g_form.setValue('reload_form', 'No');
And added below if condition.
if (g_form.getValue('reload_form') == "No" && newValue == 'Yes' ) {
location.reload();
}
Its working as expected, when value selected as No, then changes to yes, then only form will reload.
If at the first time only value is selected as 'Yes' then form won't reload.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2022 09:28 AM
Great @Lina
If your issue is resolved,
Feel free to mark correct, if your issue has been resolved, so it ends up in solved queue.
Will be helpful for others looking for the similar query.
Aman Kumar