g_form. clearMessages is not working

Aman22
Mega Contributor

g_form. clearMessages is not working in onSubmit script for a catalog form. I am trying to clear out old messages when user fills in fields and clicks submit. it seems like the old message are not going away. Below is the test script.

 

function onSubmit() {
g_form.clearMessages();
//Type appropriate comment here, and begin script below
g_form.showErrorBox("field1","Test");
return false;
}

6 REPLIES 6

Ian Mildon
Tera Guru

As previously stated, g_form.clearMessages() only works for the form message banners at the top of the record.

With you using field messages, you need to be using:

g_form.hideFieldMsg("<your field here>");

Anil9866
Tera Contributor

Hello Aman,

I know its too late to reply, but thought of sharing the information that I really tried in my PDI and the result of the 

g_form.clearMessages() - is used to clear any info or error messages added on the top of form, it won't removes any field level messages. Kindly try from your end as well. 

 

Thanks

Anil Annavarapu