This is best done with hide formulas, not script. Set the properties of your checkbox field to "Refresh choices on document refresh". Then, the line or table cell that contains the field that you want to disable can have a hide formula something like CheckboxField = "Yes".
If you want to display the value of the disabled field even though your checkbox is disabling it, add a second line beneath the hidden field with another field, computed for display, with its value being that of the disabled field. The display field needs the opposite hide formula, i.e. CheckboxField != "Yes".
I suggest using a table for formatting your fields and field descriptions, because your page can be much neater and your hide formulas can apply to individual cells rather than to whole lines.
Hope that helps.
Also, the InputEnabled event can be configured if the field uses an OS style. Seems to depend on the field datatype and other things, at least in r6.5, but it is worth looking into.
Yep
You would add also this code in the exiting event of the checkbox :
With the refesh (or refreshhideformulas maybe it’s enough) it will hide ou show the linked fields (according to your hide-when formulas)