Hi B1 I have a question about the FormField readonly setter:
It seems like SWAT is pointing to disable/enable functions when using the readonly setter.
this is a bit confusing because the property name makes one believe that the input will actually be set to readonly not diabled or enabled, just like the form.setAllFieldsReadOnly( true ) method does.
Is this intended and am I misunderstanding something?
Answer B1:
Readonly and disable are the same, as far as I know. And we have functions to change those states but sometimes the client change them directly.There was an issue some time ago and I created a ticket for a clean up, but it was never picked up. Maybe something for the next sprint.https://agile.build.one/browse/SWAT-7337
I think the initial thought here was that disable really disables the control, meaning it cannot receive focus, you cannot select anything. Readonly means you just cannot edit/change, but you can still focus and also select text
In SWAT-2137 we changed the readonly functionality to just disable the field. This is the desired functionality for now.
The readonly/disable functions are both calling the disable, then an enabled state is modified and then the watcher catches it and it's turning the field to readonly true or false. Yes. It's very weird.Short answer: Disabled and readonly are acting visually as a readonly.
Do you have a use case for enhancing this?
Answer from Oli:Thank you, I understand this but the readonly setter (field.readonly) does not set the input to readonly or not. It disables or enables the input completely (see also code screenshots).
I understand this but the readonly setter (field.readonly) does not set the input to readonly or not. It disables or enables the input completely (see also code screenshots). As I thought. However we can also select text when it's disabled. We don't see any difference.
On a use case for enhancing it: Not especially, it was just confusing bacause setting field.readonly = true on a field has not the same impact on the field as form.setAllFieldsReadonly(true).