I know we can disable a button using these codes (see below)

However, I would like to be able to use a java script / action
to set my field to read only , typically using a button.

any such pre built action ?
I just do not see it,

appreciate help

UX Component - Buttons - How to Programmatically Enable and Disable Buttons - In V12 all buttons on the UX component are 'Adanced Buttons'. (In V11 buttons could either be 'standard' or 'advanced'). Advanced buttons are implemented as Javascript objects and so in order to enable or disable them programmatically, you need to get a pointer to the object and then call the object's .setDisabled() method.

NOTE: All Javascript controls, not just buttons, in the UX (List, ButtonList, SpinList, Tree, etc.) support the .setDisabled() method.

For example:
var bObj = {dialog.object}.getControl('BUTTON_1');
//set the button disabled
//now enable the button