The CreatorCon Call for Content is officially open! Get started here.

Client Script - Read only field until other field is filled.

Halo10110
Giga Contributor

Hello, 

I am stuck on a client script or rule, where I have to make one field read only until other is filled. I am confused because onLoad() function should be read only and then I have to have onChange() so when I change the value the field should, so what is the approach? Can anybody help me please and share an example code how to approach this? Thank you!

1 ACCEPTED SOLUTION

Sebastian R_
Kilo Sage

Why don´t you use a UI Policy?

 

Example: You have to fields "Business Service" and "Assignment Group". As long as the Business Service is empty, the Assignment Group should be readonly.

You can use a UI Policy with condition ~ "Business Service ISEMPTY" -> UI Policy Action: Assignment Group = readonly.

 

Of course this could also be handled with client scripts. onChange script for field "Business Service" -> if field is empty -> g_from.setReadonly('assignment_group', true);...

View solution in original post

6 REPLIES 6

Ashish Dhole2
Kilo Expert

Refer following condition in UI Policy used in this scenario 

1] Assign to field is read only until Assignment group is filled

2] When Assignment group get filled then Assign to will  get automatically read only false 

 

find_real_file.png

 

 

Great Job Ashish.