showFieldMessage & ErrorBox msg nor working

Naveen87
Tera Guru

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

1 ACCEPTED SOLUTION

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!

View solution in original post

17 REPLIES 17

Yea, you should be fine now to do more with it, info or error, etc.

I think it was basically because you were clearing the field AFTER the message which was probably happening about the same time and so it was causing a slight glitch there.

Please mark any other reply from others, as Helpful, if it was.

Take care!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Himanshu Dubey
Giga Guru

Hi Naveen,

You can achieve this by using UI policy no need to write a script

Please refer below link to know how to achieve by ui policy

https://community.servicenow.com/community?id=community_question&sys_id=55effeaddb58dbc01dcaf3231f96...

Mark Correct if my answer solves your issue and also mark 👍 Helpful if you find my response worthy.

Thanks & Regards

Himanshu Dubey

 

Hi Himashu, 

Thank you for idea.

I had did it with UI policy only i beginning but due to changes in requirement. Approached script .

Script is fine and perfect.

Just trying to get an error msg under field.

 

Thank you