RequiredValidator not working inside template

Hello Radzen Team!

I'm implementing a custom template inside a DataList:

The template is as follows:

The validators will work with the first item in the list:

And they seem to work for the other items:

But in reality, they're all binded to the component in the first item:

My guess is that the template does not resolve the component naming, thus directing all the builded validators to the first item.

Hi @kim,

Do you have a RadzenTemplateForm inside the template? A form is required for validation to work as expected.

The only other component that supports validation besides the RadzenTemplateForm is the RadzenGrid in inline editing mode. We did that because one cannot nest a <form> inside a <tr>.

I didn't have a RadzenTemplateForm inside the template, so I added one and put all the components inside. Now the project won't build and throws the following error:

Do you have another template form which is a parent of the datalist? Also you should avoid using TItem="dynamic". Just set the Data property of the template form to globalModelsRuleTime.

Yes, there is a parent template form:

<RadzenTemplateForm Data="@rule" TItem="Global.Models.Rule" Visible="@(rule != null)" Submit="@TemplateFormSubmit">

The TItem="dynamic" was automatically generated by Radzen. I then added it as a custom attribute and put the suggested value in the Data property, and here's the final result:

However the error still persists:

Hi @kim,

Nesting of forms is not supported. What exactly are you trying to achieve? I have a feeling it isn't supported by Radzen.

I'm trying to implement access rules in my access control app. Every access rule has n amounts of allowed time periods, where each time period has a day of the week, a start datetime and a finish datetime.

The only reason I'm using the validators is to not force initial dates to the user. What I'll do instead is to place a default date in the datepickers and block user attempts to reset it.