- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2020 05:20 AM
Hey Guys,
Im trying put an error or info message under the field. But it's not reflecting.
g_form.showFieldMsg("start_date","Selected Date is in past, Select a valid date","info",true);
suggest me something here
Solved! Go to Solution.
- Labels:
-
Change Management
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2020 05:58 AM
Hi,
Was that not happening before?
Actually, you know what...hmm...try clearing the field first THEN do your field message.
g_form.setValue('start_date', ''); // Setting the variable as empty
g_form.showFieldMsg('start_date', "Test 123", 'error');
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2020 05:45 AM
Hi Allen,
Below is client script:
function onChange(control, oldValue, newValue, isLoading){
if(isLoading)
{
return;
}
//start the validation
var change = g_form.getValue('u_change_type');
//if(newValue != '')
if(newValue != '' && (change != 'emergency' && change!=''))
{
var ga = new GlideAjax('ConfirmDate');
ga.addParam('sysparm_name', 'chkCurrDate');
ga.addParam('sysparm_date',g_form.getValue('start_date'));
ga.getXML(NewParse);
}
function NewParse(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
if(answer == 'false'){
//alert("Selected Date is in past, Select a valid date");
g_form.showFieldMsg("start_date","Selected Date is in past, Select a valid date","info",true);
g_form.setValue('start_date', ''); // Setting the variable as empty
}}
}
Script include:-
var ConfirmDate= Class.create();
ConfirmDate.prototype = Object.extendsObject(AbstractAjaxProcessor, {
chkCurrDate : function() {
var start = this.getParameter('sysparm_date');
var currDay = gs.now();
if(start < currDay){
return false;
}
else
{ return true; } } });

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2020 05:47 AM
Can we try....
g_form.showFieldMsg('start_date',"Test 123",'error');
Then from there, you can change it up a bit more, but let's bring it back to something more basic for now.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2020 05:55 AM
No msg popped .
But past value was cleared from field as it was past date.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2020 05:58 AM
Hi,
Was that not happening before?
Actually, you know what...hmm...try clearing the field first THEN do your field message.
g_form.setValue('start_date', ''); // Setting the variable as empty
g_form.showFieldMsg('start_date', "Test 123", 'error');
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2020 06:12 AM
It was happening before as well .
It was showing a alert msg.
//alert("Selected Date is in past, Select a valid date"); This was written.
Your above suggestion of writing it after clearing the field worked.
Thank you so much.
If i need to make it a info msg , then i have to replace "error" by "info" right?
No need to ErrorBox. "error" in showFieldMsg will work right?
Thank you so much for the help.