- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2023 06:55 AM
I have a HRSD form with three fields first_name, last_name, user_name. I have an onChange client script on the first_name and last_name variables that will set the user_name field and this is working as expected. My issue is if a user deletes the data in the first_name and last_name fields the user_name field retains the original data. I need this cleared out. I attempted the below script but it's not working.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (g_form.getValue('first_name' == "") && g_form.getValue('last_name' == ""))
g_form.setValue('user_name', ' ');
}
Any thoughts on where I'm going wrong here?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2023 06:59 AM
HI @Scott Megargee ,
I trust you are doing great.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
if (g_form.getValue('first_name') == "" && g_form.getValue('last_name') == "") {
g_form.setValue('user_name', '');
}
}
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2023 06:59 AM
HI @Scott Megargee ,
I trust you are doing great.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
if (g_form.getValue('first_name') == "" && g_form.getValue('last_name') == "") {
g_form.setValue('user_name', '');
}
}
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2023 07:16 AM
Thanks Amit. Appreciate the quick response worked great.