I've been trying to include a disabled form field in my custom form (Squiz Matrix v.4.18).
It is just a text input field which is pre-populated with the date via: %globals_date_d-m-Y% which I want to be visible to the user, but not be editable.
I've tried adding:
disabled="disabled"
disabled
Which both look like they work, but they don't submit the input value. Whereas adding:
readonly="readonly"
readonly
Does submit the input value, but doesn't seem to add the same nice visual and behavioural cues (from the browser) which indicate that the field cannot be edited (such as dimming the text, and not allowing the user to tab to the field etc).
Is the disabled attribute purposefully disallowed, or is this a bug (as disabled is a perfectly valid html attribute)?
If you wish to submit a a value, use a readonly field, and style it appropriately with css.
It is also possible to hijack the submission event with javascript and add the value of the disabled field back into the submission before it's sent, but that is probably a silly way to do it.