Clear HTML variable type value in client script

siva54
Tera Contributor

Let's consider a Variable abc and its Variable type is HTML.. I Want to populate the value in the variable abc based on the other variable selection.

I struck in clearing the HTML field value.
I used g.form.clearValue() and g_form.setValue to empty. In ui policy clear variable to true..
But the variable value is not clearing. Please suggest some solution

2 REPLIES 2

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @siva54 

 

LearnNGrowAtul_0-1707474527238.png

 

 

It is working for me.

 

LearnNGrowAtul_1-1707474553931.pngLearnNGrowAtul_2-1707474565559.png

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Aniket Chavan
Tera Sage
Tera Sage

Hello @siva54 ,

You can achieve this without any code by following @Dr Atul G- LNG  sir's solution, still if you want you can also use onChange client script and add your logic in there and add the below code to clear the variable value of your HTML variable type along with your existing functionality to populate the value.

 

    var clearvalue = '';
    g_form.setValue('abc', clearvalue);

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks,

Aniket