Declined
Last Updated: 28 May 2020 08:00 by ADMIN
James
Created on: 20 May 2020 15:28
Category: Form
Type: Feature Request
0
Allow form items to be readonly by default

It would be great if the form configuration allowed for items to be readonly or disabled during setup.  There are times when perhaps some data should not be able to be changed.

I'm having to do tricks such as this for each field I want readonly.

$("#fileSize").data("kendoNumericTextBox").readonly(true);
$("#originalFilename, #title").kendoTextBox({ readonly: true });
4 comments
ADMIN
Dimitar
Posted on: 28 May 2020 08:00

Hello James,

Thank you for your feedback.

As the requested functionality can be achieved through the specified approach, I would suggest utilizing it for marking specific editors as readonly. Also, adding an option to the items configuration will be ambiguous with the readonly editor option. Taking this into consideration, I will mark this request as "Declined".

Regards,
Dimitar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
James
Posted on: 27 May 2020 08:37

Hello Dimitar,

I can imagine times when it might be useful to set the readonly flag of a field based on a property in the data as you suggest.  I guess it is already possible using some custom code though.

James

ADMIN
Dimitar
Posted on: 27 May 2020 05:27

Hello James,

When using one of the built-in editors of the Form the widget can be marked as readonly through the editorOptions option:

{
  field: "ProductID", 
  editor: "ComboBox", 
  editorOptions: {
      ....
      readonly: true                         
  }
}

In cases where custom markup needs to be used, then the attribute can be added through a custom editor as you have demonstrated.

Do you consider the above mentioned approach useful, or would you rather configure this through the items configuration (e.g item.readonly) ?

Regards,
Dimitar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
James
Posted on: 20 May 2020 16:21

As a workaround I have used a function.

editor: textboxInput, editorOptions: { readonly: true }

function textboxInput(container, item) {
        container.append($(`<input type="text" name="${item.field}" ${item.validation.required ? 'required="required"' : ''} ${item.validation.readonly ? 'readonly' : '' } class="k-textbox"></input>`));
    }