How to change a field value on UI page from the client script?

Kalyani
Tera Contributor

Hi All,

Please find the scenario below:

I have a UI page with 4 fields. When the field value for one field (field A) changes, I need to check if other three fields are empty or filled. If the three fields are empty, I need to display a message on the UI page to request the user to fill in other three fields. And also, wipe off the value of field A which the user first entered.

g_form.setValue("fieldA","") in the client script of UI page doesn't work

Please suggest a way to achieve it

Thank you

 

1 ACCEPTED SOLUTION

so you want to empty your html field. i thought you want to empty normal form field.

 

you should use below two line instead of g_form.

 

gel('sys_display.handover_by').value = "";

gel('handover_byLINKreplace').style = 'visibility: hidden; display: none;';

 

Note: I have tested it on my personal instance. 

 

If my answer helped you , kindly mark it as correct and helpful.

 

View solution in original post

6 REPLIES 6

so you want to empty your html field. i thought you want to empty normal form field.

 

you should use below two line instead of g_form.

 

gel('sys_display.handover_by').value = "";

gel('handover_byLINKreplace').style = 'visibility: hidden; display: none;';

 

Note: I have tested it on my personal instance. 

 

If my answer helped you , kindly mark it as correct and helpful.

 

Kalyani
Tera Contributor

Hi Harshvardhan,

Thank you very much for your response.

It worked!

Can you please guide me with displaying a message on the UI Page?

I'm using alert and it is working. But I want it to display as a message 

tried using addInfoMessage, addErrorMessage and clearMessages...but it is not displaying