This is a migrated thread and some comments may be shown as answers.

Disable form field

3 Answers 2770 Views
Form
This is a migrated thread and some comments may be shown as answers.
Herrick
Top achievements
Rank 1
Herrick asked on 03 Sep 2020, 01:40 AM

Dear Sir/Madam,

I am working on a Kendo Form in which I would like one of the fields to be read only. The field's definition is simply: { field: "someField", label: "Some Field" }

In order to make the field read-only I'm guessing I should be using the "attributes" property but I'm not sure. I have not found any example on the use of the "attributes" property.

Would you be able to provide an example showing how to make the field read-only please?

Thanking you in advance for your assistance.

 

Herrick

3 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 04 Sep 2020, 05:52 AM

Hello Herrick,

You can indeed mark a simple field as disabled through the items.attributes option as follows:

$("#exampleform2").kendoForm({
    formData: {
        Username: ""      
    },     
    items: [{ 
        field: "Username", 
        attributes: { disabled: true } 
    }]    
});

In case you would like to achieve the same with one of the built-in editors, you can utilize the item.editorOptions and set the respective editor's disabled option to true.

Regards,
Dimitar
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).

0
Herrick
Top achievements
Rank 1
answered on 10 Sep 2020, 07:25 AM
Thank you very much Dimitar!
0
Acq
Top achievements
Rank 1
answered on 21 Nov 2020, 07:19 PM
Maybe this can help: https://stackoverflow.com/questions/34627643/how-to-set-disable-reaonly-kendo-ui-controls
 
Tags
Form
Asked by
Herrick
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Herrick
Top achievements
Rank 1
Acq
Top achievements
Rank 1
Share this question
or