Make field Readonly -Onload

ch_karthikeya
Tera Contributor

when form is Loaded -if User name( value :User)   is Empty then Devision field should be Readonly

find_real_file.png

var gd=g_form.getDisplayValue('User');

if(gd== "   ")  

{

g_form.setReadOnly('devision',true);

}

}

it is not working as per my expectation

1 ACCEPTED SOLUTION

Simon Christens
Kilo Sage

Try



var gd=g_form.getValue('User');


if(gd== "")


{


g_form.setReadOnly('devision',true);


}


}


View solution in original post

8 REPLIES 8

Simon Christens
Kilo Sage

Try



var gd=g_form.getValue('User');


if(gd== "")


{


g_form.setReadOnly('devision',true);


}


}


after form loaded it became read only, if i select value after form load , can i access Devision???


you'll either have to configure an onChange script to change make readonly false or save the form so it loads again and makes the field editable.



you can avoid this by using a UI policy, it will reverse if false dynamically as the form changes


Hi Karthikeya,



Please write the script on OnChange Client Script   Field Name should be User Name



if((isLoading)||(newValue=='')){


return ";


}


var gd=g_form.getValue('User');


if(gd== "")


{


g_form.setReadOnly('devision',true);


}else{


g_form.setReadOnly('devision',false);


}


}



Please Mark Correct / Helpful If your query is resolved



Regards


Rajesh Kumar Annepaka