Issue: `readonly` attribute on input controls ignores true/false values, so it's always readonly.
Question: Is there an easy way to toggle it on/off?
-----------------------
I have a form with input controls
I would like to prevent the user from entering data under certain scenarios
We set Enabled as false on input controls however it's difficult for users to select the text from inputs such as text area. And when it's disabled, they can't change the size of the text area, which they've requested
`readonly` attribute was recommended to me as an alternative to setting Enabled as false.
I had set it as true and false pending the condition, however the behaviour was the same, which made sense after seeing documentation on it.
My workarounds are go back to setting Enabled to false, or putting plain text control as a replacement for the input control, but readonly would be the ideal scenario
Hi @Andrew Bowen, add the below style to your input,pointer-events: auto;It will allow users to select text from inputs and resize the text area, even if they are disabled.ThanksGitansh Anand
This works, thank you :)
Hi @Andrew Bowen,
Go to your input/Text Area property where you can see Enabled property,
Now by default there is only 2 options true or false,
But in your case you want to make it dynamically,
So crate a local variable of Boolean type and assign it to the enabled property of your input box,
So whenever you assign this local variable to false your input control read-only else it'll be enabled,
I hope it'll help you.
Thanks
Deep
Hi Deepsagar, thank you for the reply but this was already the behaviour I had.
The issue is when it's dynamically set to false, the user can not select the text easily to copy/paste into another system.