Tag Helper - Model Validation Attributes not rendered

1 Answer 436 Views
TextArea
Daniel
Top achievements
Rank 3
Iron
Iron
Iron
Daniel asked on 17 Mar 2022, 01:46 PM | edited on 17 Mar 2022, 01:49 PM

Hey guys,

I think it is a bug because the requried validation attribute is not rendered when using tag helper. Can you validate my problem?
Kendo version: 2022.1.119

Model:

[Required(ErrorMessage = "Hey, I am an error message.")]
public string Test { get; set; }

View (working example with html helper):

@Html.Kendo().TextAreaFor(x => x.Test).Rows(3)

View (not working example with tag helper):

<kendo-textarea name="Test" rows="3"></kendo-textarea>

 

The data-val="true" data-val-required="xxx" attributes are only rendered with html helper.

1 Answer, 1 is accepted

Sort by
1
Accepted
Aleksandar
Telerik team
answered on 22 Mar 2022, 06:21 AM

Hi Daniel,

Upon investigation I see the `for` configuration is not actually implemented for the TextArea TagHelper. Currently the model attributes are not rendered as the TextArea is not bound to the model property. I have logged a request on the functionality on your behalf, so the following will become available and the TextArea can be bound to a model"

<kendo-textarea for="@Model.Test" rows="3"></kendo-textarea>

Until the above request is implemented you can either use the HTML Helper, add the validation attributes manually, or use a TextBox or an Editor component, where the `for` tag is exposed:

<kendo-textbox for="@Model.Test"></kendo-textbox>
<kendo-editor for="@Model.Description"></kendo-editor>

Finally, I have updated your Telerik points, as this is indeed a valid request.

Regards,
Aleksandar
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.

Tags
TextArea
Asked by
Daniel
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Aleksandar
Telerik team
Share this question
or