<input class="form-control" readonly="@(!EditMode)" type="text" @bind="@FormField.TextValue"/>
Hi Greg,
The reasons to decline readonly components are listed in this thread.
Styling and copying from disabled components will be possible in the future. Currently they are possible with minor tweaks to the theme - I assume that you have already seen the linked threads in this discussion.
To achieve readonly DropDowns - use the ValueChanged event with one-way binding for the Value parameter. Then, do not update the value in the handler.
Regards,
Dimo
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
I agree - a ReadOnly state is important.
There is a big difference between ReadOnly and Enabled.
When setting Enabled to false, all of the controls get dimmed (looks bad), and as previously mentioned you can't copy text from disabled controls.
A ReadOnly state would prevent editing of the controls but allow selecting text/values for copy/paste as necessary.
More importantly, A ReadOnly mode should NOT change the appearance of the controls. Many times we want the user to experience a seamless visual transition from ReadOnly to Editable and we want consistency. The programmer can add other visual cues if the state is ReadOnly or Editable as desired.
For drop-downs the list should be available, but the control would prevent changing the selected item. Thus the user could see all options but not be able to change the selected item.
Hello,
For copying capabilities from disabled inputs, please vote for and follow this one: https://feedback.telerik.com/blazor/1483630-allow-selecting-and-copying-text-from-inputs-with-enabled-false.
Regards,
Marin Bratanov
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Hi,
in the case of a textbox or textarea the state of disabled limit the functionality of the control, since for the user it is not possible to select and copy the content.
It is good to hear you have things working as you need them.
I am, indeed, closing this one because at this point I am not sure I see the reason for a readonly attribute in Blazor, considering we have Enabled. Of course, feel free to comment if I am missing some use case, and this can be reopened.
For anyone else interested in similar features, I suggest reviewing the following pages, as well:
Hi Marin,
Apologies for the late reply. TBH in the end I created my own dropdown control which shows a read only form control when in "read only" mode, and a normal dropdown (with bootstrap styling) otherwise.
So I can't really remember where I was and whether Enabled would suffice. What I wanted was to be able to copy the text from the currently selected item in "read only" mode and then have it behave as a normal dropdown in "edit" mode.
My code's running well so I don't really have time to go back and experiment. Please feel free to close this issue if you want to.
Thanks,
Nick
Could you try using the Enabled property? Does it suit your needs? If not, what is the difference from it that you would expect?