Hi,
There are multiple options for you to do it.
But there isn’t a direct way for doing it based on a ‘<on-change>’ event, as you can do for the <set-visible> or <set-required> elements, for example.
Examples:
1- <field name="readonly1" readonly="true">
2- <field name="readonly2" readonly="isScreenReadOnly()">
3- <field name="readonly3" readonly="incidentStatus = 'validated'">
4- The dynamic tricky way needs to use an additional field:
<field name="x_aux1">
<label>x_aux1</label>
<on-change>
<set-value name="temp.x_flg" value="true"/>
</on-change>
</field>
<field name=" temp.x_flg" type="boolean">
<label>x_flg</label>
</field>
<field name="readonly4" readonly="temp.x_flg">
Cheers and good luck,
Luís Pereira