Field Message Disappearing on Change

kailashthiyagar
Kilo Guru

I have set field msg for one of the "List" field in my form in my onLoad Script... It works fine but when i change values in the "List", the field msg disappears... Do i need to write another client script onChange also for adding the field msg? If so , why?

4 REPLIES 4

oharel
Kilo Sage

Yes. Once you change a value on the list, the message will disappear.


And yes, if you want to keep the message, you will need an onChange for the field.



Can't tell you for sure why this is so, but I think it is because an onLoad represents the value of the field at the moment of loading. Once you change a value in the list, it changes from the onLoad value so the message disappears.


harel


Thanks but other than that there is no permanent way of having field msg set in a form.. Is that right?


I do not know of any way to do that.


However, I can offer a sort of workaround: Add an annotation field.


Configure -> Form layout


add *Annotation field right under the field where you want it to show.


In the Annotation text box, type:


<div id="anno1"><span style="color:red"><b>Message1</b></span></div>


Save



You don't need the <div id="anno1"> and the </div> parts for it to work, unless you want to use them in client script to show/hide the annotation.



harel


smicloud
Tera Guru

Just use a client onChange script to add the message. It works for me and presents the information both when loading and changing the value in the field. I.e. in practice it fulfills the need for a static message.



You may need to clear all field messages before adding the message (g_form.hideAllFieldMsgs();).