- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2023 10:08 PM
Currently this alert is pop on selection of every field in the form, before submitting the form. I want it to pop up on only 1 field when the form is submitted.
any solution to my query?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2023 10:22 PM
This script will generate an alert if no Locations is submitted, since you only check if they are equal.
Maybe you should add a check so see if they contain a value first, before evaluating if they are the same?
function onSubmit() {
var primaryLocation = g_form.getValue('u_primary_location');
var secondaryLocation = g_form.getValue('u_secondary_location');
if (primaryLocation || secondaryLocation) { // added check so see if any location contains a value
if (primaryLocation == secondaryLocation) {
alert('Primary Location and Secondary Location cannot be same');
return false;
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2023 10:29 PM
Hi @Mehar Naaz,
Open the particular form and configure the client script (onChange or onSubmit) for that and check the condition.
Regards,
Himanshu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2023 10:11 PM
Hi @Mehar Naaz,
Can you share the script you have written on this
Mark this answer as correct and helpful if it solves your issue.
Regards,
Siva Jyothi M.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2023 10:16 PM - edited ‎09-04-2023 10:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2023 10:20 PM - edited ‎09-04-2023 10:25 PM
Is this the only script written on the form?
Mark this answer as correct and helpful if it solves your issue.
Regards,
Siva Jyothi M.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2023 10:22 PM
This script will generate an alert if no Locations is submitted, since you only check if they are equal.
Maybe you should add a check so see if they contain a value first, before evaluating if they are the same?
function onSubmit() {
var primaryLocation = g_form.getValue('u_primary_location');
var secondaryLocation = g_form.getValue('u_secondary_location');
if (primaryLocation || secondaryLocation) { // added check so see if any location contains a value
if (primaryLocation == secondaryLocation) {
alert('Primary Location and Secondary Location cannot be same');
return false;
}
}
}