Is there a way to check if a reference field gets cleared in an OnChange Client Script

Eric Woody
Tera Expert

Basically what the subject says, I need a way to see if a reference field is cleared (user just highlights and deletes the content). OnChange doesn't capture it even removing the newValue == '' default at the top of it. I'm guessing because it's technically not cleared and the value hasn't really changed. Is there a way around this? I'm aware I can do this in a Business Rule, but I really prefer not to. 

 

Generic example of what I'm doing if needed:

 

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}

if(newValue == ''){
g_form.addErrorMessage('My Error Message');
g_form.setValue('ref_field', oldValue);
}
//Type appropriate comment here, and begin script below
}

 

 

 

1 ACCEPTED SOLUTION

Eric Woody
Tera Expert

I figured out the issue. I was having a brain fart I guess. Just needed to check the inherited checkbox as where the script was running was on a child table. (facepalm)

 

Thanks everyone.

View solution in original post

5 REPLIES 5

Eric Woody
Tera Expert

I figured out the issue. I was having a brain fart I guess. Just needed to check the inherited checkbox as where the script was running was on a child table. (facepalm)

 

Thanks everyone.