How to make read-only text field on the basis of condition

Accepted answer

https://jazz.net/library/article/997#dyncondition
Comments

Donald Nong yes you are right i'm not creating validation for above scenario, that why i have create a condition, could you please just incorporate Read-only part in above provided script ???

It appears that you did not completely understand what I meant. Let me put it this way, you will need two (not just one) scripts to achieve what you want - a "validation" script to make sure the attribute is mandatory, and a "condition" script to make sure the attribute is read-only. You cannot mix them together.

Donald Nong Thanks brother for the clarification but how can i create the second script which will be used as condition for read-only part, could you please help me

An example was already given in my original answer.
See the "Dynamic read-only attributes with conditions" section in the below article for details.
https://jazz.net/library/article/997#dyncondition