How to set focus on mandatory fields if they are not filled?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2014 03:57 AM
Hi all,
I observed, if mandatory fields are not filled and we try to submit the form, it gives the prompt window, stating 'the below are fields are mandatory: fieldname1, fieldname2..". Once we click OK, it sets the focus (cursor) on the unfilled mandatory field. This functionality works only if the field appear on the form, if the field is in section, it doesn't. Any suggestion how to achieve it.
Also as mentioned fieldname1, field name2 on the prompt message, they do not follow any order (i am expecting they should be in the order they were placed on the form).
kindly help.
Regards,
Saranesh.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2014 02:11 AM
Hi Marcelo,
Thanks for the info, this is interesting. Could you please let me know what is the name of original function this mandatory functionality uses, i hope this should be script inclue. I tried searching it, but no luck.
To my wonder, i dint find the message "The following mandatory fields are not filled in" in the messages table too. could you help me on this.
Regards,
Saranesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2014 05:44 AM
Unfortunately this kind of script is not accessible for mortals like us SNOW are the only ones that can change this kind of functions. In order to find it, you have to use the developer tools on your browser (I pasted the original name),
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2014 08:40 AM
I dint know this . Thank you.
Any inputs on my second question, in regards to order of displaying field names on prompt window.
Thanks,
Saranesh.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2014 02:24 AM
More info : GlideForm (g form) - ServiceNow Wiki
flash
- Flashes the specified color the specified number of times in the field. Used to draw attention to a particular field.
- Parameters:
- widgetName - specifies the field with <table name>.<fieldname>.
- color - RGB color or acceptable CSS color like "blue" or "tomato."
- count - integer that determines how long the label will flash.
- use 2 for a 1-second flash
- use 0 for a 2-second flash
- use -2 for a 3-second flash
- use -4 for a 4-second flash
- Returns:
- void
- Example:
g_form.flash("incident.number", "#FFFACD", 0);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2014 02:30 AM
Hi,
Use it as per your req.
if(g_form.getValue('fieldName') != ""){
g_form.getControl('fieldName').focus();
return false;
}