To get UserID in Onchange() Client Script

Ashok32
Tera Contributor

Hi All,

 

   I have a "request for" reference field in that field default value is logged in userid. So, If I select "exists"(its a checkbox) as No, then request for should be cleared. When I select back to "exists" as 'Yes' then UserID should be populated. 

 

 

Can anyone help me to achieve this.

 

Thanks in advance

5 REPLIES 5

Basheer
Mega Sage

Hi @Ashok32 

You can write an OnChange client script to achieve this and code as below

 

var exist = g_form.getValue('u_exists'); 
if(exist == false) {
g_form.clearValue("requested_for"); // You can also use g_form.setValue("requested_for"," ");
}
else{
g_form.setValue("requested_for", g_user.userID);
}
     

 

 

Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

Cheers,
Mohammed Basheer Ahmed.