- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 05:20 AM
Hello Everyone,
I need your help, I need to access the value of the drop-down menu which is available of form, and if the user select ABC from drop-down menu than it will compare the location and if user select XYZ then it will not.
my code:
var ch = g_form.getValue('type_of');
if (ch == "ABC"){
if (g_form.getValue('loc1') == g_form.getValue('loc2')){
g_form.addErrorMessage('Location can't be same');
}retrun false;
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 06:15 AM
Hi,
Please use below script and see what value you get using g_form.getValue().
var ch = g_form.getValue('type_of');
alert('You have selected : '+ch); / this will help you to get background value of Type variable.
if (ch == "abc") { //update this condition with value of choice ()
if (g_form.getValue('loc1') == g_form.getValue('loc2')) {
g_form.addErrorMessage('Location can\'t be same ');
return false;
}
}
You might be using Label in If condition instead use value of choice 'ABC' for field type_of.
Thanks,
Anil Lande
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 05:59 AM
The logic shared by Palanikumar is correct.
What is the issue?
Do you want this Error message when user change options and locations are same?
or do you want to stop submissions?
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 06:03 AM
I want an error message when locations are the same. only for the ABC scenario.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 06:15 AM
Hi,
Please use below script and see what value you get using g_form.getValue().
var ch = g_form.getValue('type_of');
alert('You have selected : '+ch); / this will help you to get background value of Type variable.
if (ch == "abc") { //update this condition with value of choice ()
if (g_form.getValue('loc1') == g_form.getValue('loc2')) {
g_form.addErrorMessage('Location can\'t be same ');
return false;
}
}
You might be using Label in If condition instead use value of choice 'ABC' for field type_of.
Thanks,
Anil Lande
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 06:28 AM
Did you try the updated code I shared? Your old code had some syntax errors. I fixed them. Please try and let me know if this there is any other issue
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 09:01 AM
I have one more question, in my approval mail notification, I put all the fields from my form. so on my form, I have a drop-down menu, if the user select location then the old and new location field will appear. and if the user selects transfer then apart from the locations field user name will also appear. I don't want to create another approval notification so how i can achieve this.
Requested ITEM Number: | ${document_id.URI_REF} |
Item: | ${document_id.cat_item} |
Type of Movement: | ${document_id.variables.type_of_movement} |
Requested For: | ${document_id.variables.requestedFor_user_name} |
Email Id: |
${document_id.variables.employee_id} |
User Location: |
${document_id.variables.user_location} |
New User Name: |
${document_id.variables.new_user} |
New Location: |
${document_id.variables.new_user_location} |
Asset Details: |
${document_id.variables.assets_to_transfer} |
Justification: | ${document_id.variables.justification} |