Declined
Last Updated: 01 Mar 2022 08:48 by ADMIN
Nick
Created on: 21 Jun 2019 16:29
Category: UI for Blazor
Type: Feature Request
10
Support a read only state for all editor controls
Standard input controls support a readonly attribute. The read only state can be applied in Blazor like this:
    <input class="form-control" readonly="@(!EditMode)" type="text" @bind="@FormField.TextValue"/>

As far as I can tell none of the Telerik input controls support a read only mode. Putting the same attribute on TelerikDropDownList for instance (not surprisingly) results in this:

WASM: System.InvalidOperationException: Object of type 'Telerik.Blazor.Components.DropDownList.TelerikDropDownList`2[[FolioMetrics.Core.Types.Model.PicklistValue, FolioMetrics.Core.Types, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3b4aae723ff25d84],[System.Int32, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' does not have a property matching the name 'readonly'.

Can we have all the controls sort a read-only state please?

7 comments
ADMIN
Dimo
Posted on: 01 Mar 2022 08:48

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.

Greg
Posted on: 22 Feb 2022 19:26

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.

 

 

 

ADMIN
Marin Bratanov
Posted on: 20 Feb 2022 15:05

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/.

Stefano
Posted on: 18 Feb 2022 16:40

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.

 

ADMIN
Marin Bratanov
Posted on: 05 Jul 2019 05:46
Hi Nick,

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:


Regards,
Marin Bratanov
Progress Telerik UI for Blazor
Nick
Posted on: 04 Jul 2019 14:36

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

ADMIN
Marin Bratanov
Posted on: 24 Jun 2019 14:01
Hi 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?


Regards,
Marin Bratanov
Progress Telerik UI for Blazor