How to popup message or alert on Servicenow portal for Quantity drop-down field ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2020 11:12 AM
Hi All,
I want to popup a message /alert if user is selecting more than 8 quantity in the below drop down field(snap 1).
Do I need to do the coding in HTML template or Client script or Server script ? I have find coding part for this field in HTML template (snap2)
Please let me know how I can popup message and stop user to select more than 8 number /qty ?
Snap1:
Snap2:
Thank you.
Regards,
Virendra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2020 09:07 PM
Hi,
seems it is unable to find html element with that class
try checking on portal if any html element with that class is present or not
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2020 08:05 AM
Thank you! This worked once I changed the highlighted line.
function onSubmit() {
if(window == null){
var z = this.document.getElementsByClassName("select2-chosen");
//if(z[1].innerHTML > 8 ){
if(z[0].innerHTML > 8 ){
alert('Please select value less than 8');
return false;
}
}
else{
var quantity = $j('#quantity').val();
if(quantity > 8){
alert('Please select value less than 8');
return false;
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2020 09:16 PM
You are welcome
Do remember to mark appropriate responses as helpful
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader