clearFormMessages() is not working !

nareshpittu769
Tera Contributor

I tried adding message by using addFormMessage() it's working fine 

but i want to remove the form message so i used clearFormMessages(), it is not clearing the message

 

then i used clearMessages() it' s working fine, but why clearFormMessages() not working ? can any one explain

 

 Screenshot 1946-02-12 at 2.29.04 PM.pngScreenshot 1946-02-12 at 2.29.12 PM.png

C Naresh
2 REPLIES 2

DugyalaN
Tera Contributor

The clear functions like clearFormMessages('error') or even clearAllFormMessages() often don’t work as expected inside an onLoad or onsubmit client script because of timing issues

Why clear functions don’t work well in onLoad:

  • When the form is loading, the messages you add (like with addFormMessage) haven’t actually been shown on the screen yet — they are just “queued” to appear.

  • If you call a clear function right away in the same onLoad script, it tries to clear messages before they exist visually.

  • So the clear call doesn’t find any message elements to remove, and nothing happens.

Nikhil Bajaj9
Tera Sage

Hi @nareshpittu769 ,

 

Have you tried clearAllFormMessages() method. Try and share feedback.

 

Regards,

Nikhil Bajaj

Please appreciate my efforts, help and support extended to you by clicking on – “Accept as Solution”; button under my answer. It will motivate me to help others as well.
Regards,
Nikhil Bajaj