- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2017 11:54 AM
I'm currently trying to create a script for validating at least one field is filled on a catalog item. One field is a reference field and the other is a single line text field. Here is the script that I'm using:
function onSubmit() {
if (smcstm_fairview_charge_department == 'NULL' && smcstm_ump_charge_string == '') {
alert('You must fill in the department code');
return false;
}
}
For some reason, it's stopping me from submitting the record.
Any help is appreciated.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2017 01:41 PM
Hello Jody,
Replace your script with the below script and let me know the outcome.
function onSubmit() {
//Type appropriate comment here, and begin script below
var chgDep = g_form.getValue('smcstm_fairview_charge_department');
var umpStg = g_form.getValue('smcstm_ump_charge_string');
if(!chgDep && !umpStg)
{
alert('You must fill in the department code');
return false;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2017 01:47 PM
This worked, thanks Pradeep!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2017 01:48 PM
Awesome. Thanks for participating in the community!