clearValue based on change of another field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2013 10:23 AM
Need a script to clear a field based on a change to another field. If the Software Maintenence [u_sa] field is changed from true to false, I want the Software Expiration Date [u_sa_expiration] field to be cleared. I realize this is pretty basic; I'm new to JavaScript and what I've tried hasn't worked.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2013 11:22 AM
What you describe can be accomplished with an onChange client script:
Name: Clear Software Expiration onChange
Type: onChange
Field name: Software Maintenence
Script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == 'true') {
return;
}
if (newValue == 'false') {
g_form.setValue('u_sa_expiration', '');
}
}
Let me know if you are still having difficulty, or have any questions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2014 12:39 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2014 01:40 PM
I got mine working as well. I appreciate the tip.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2017 09:34 AM
Hello Christopher,
I have a similar issue, the difference being that I have actual choices rather than true or false. I did a very similar script but it doesn't work.
Do you see anything wrong or have any suggestions?
Thanks!
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
if (newValue == "Vendor payment term change") {
g_form.setValue('early_payment_value', '');
}
else if(newValue == "Early release of payment") {
g_form.setValue('annual_purchase', '');
}
}