Change form field to editable/non editable based on drop down selection
Hi all,
I am creating a fillable form to collect data, however two of the selectable fields require additional information.
I have created the page with the following fields:

The drop down includes 'Companies House' and 'Office for Students'. When either of these are selected, the wording on the left of the text box changes to ask for the required number. All other selections should be N/A.
The issue I have is trying to make the text box be uneditable and not required when N/A is showing and editable/required when 'Companies House' or Office for Students (OFS)' is selected.
The code I am using in the dropdown is:
var number = this.getField("Company/OFS Number");
if(event.value == "Companies House")
number.value = "";
else if(event.value == "Office for Students (OFS)")
number.value = "";
else number.value = "N/A";
If I add 'number.readonly = true;' to the end, it locks the form and adding 'number.readonly = false;' gives an error.
Any assistance in resolving this would be most welcome.
