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

Required in Model doesn't generate correct HTML5

4 Answers 48 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Luca
Top achievements
Rank 1
Luca asked on 12 Nov 2015, 11:33 AM

Hello to all.

I'd like to validate a field, for example the standard Title field in an Calendar Event.

The validation works well in the BASIC example:

http://demos.telerik.com/aspnet-mvc/scheduler/index

I added the [Required] attribute on the Model.

Anyway in my code, the generated HTML code doesn't have the "required" attribute end not any validation is performed.

Someone can help me please?

 

4 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 16 Nov 2015, 09:46 AM
Hi Luca,

I tried to reproduce the described behavior on our side but to no avail - the validation is expected after adding the "Required" annotation attribute. Could you please check the attached project and let me know how it differs from your real setup?

Regards,
Vladimir Iliev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Luca
Top achievements
Rank 1
answered on 16 Nov 2015, 10:32 AM

This is a GOOD SUPPORT!

(at the moment I'm really happy witho your products/supports).

 

So the porblem was: use a nullabel int instead an int :-)

 

So

 [Display(Name = "Stanza/Locale")]
//[Required(AllowEmptyStrings = true, ErrorMessage = "xxx")]
public int? RoomID { get; set; }

 

instead of

 

[Display(Name = "Stanza/Locale")]
//[Required(AllowEmptyStrings = true, ErrorMessage = "xxx")]
public int RoomID { get; set; }

 

0
Luca
Top achievements
Rank 1
answered on 16 Nov 2015, 10:35 AM
PS: how can I edit posts? :-)
0
Vladimir Iliev
Telerik team
answered on 16 Nov 2015, 12:14 PM
Hello Luca,

I'm glad that the demo help you.

Also please note that the posts does not support editing currently in order to keep valid history of the support conversation.

Regards,
Vladimir Iliev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Scheduler
Asked by
Luca
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Luca
Top achievements
Rank 1
Share this question
or