Required in Model doesn't generate correct HTML5

5 posts, 0 answers
  1. Luca
    Luca avatar
    7 posts
    Member since:
    Nov 2015

    Posted 12 Nov 2015 Link to this post

    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?

     

  2. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 16 Nov 2015 Link to this post

    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
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Luca
    Luca avatar
    7 posts
    Member since:
    Nov 2015

    Posted 16 Nov 2015 in reply to Vladimir Iliev Link to this post

    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; }

     

  5. Luca
    Luca avatar
    7 posts
    Member since:
    Nov 2015

    Posted 16 Nov 2015 in reply to Luca Link to this post

    PS: how can I edit posts? :-)
  6. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 16 Nov 2015 Link to this post

    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
Back to Top
UI for ASP.NET MVC is VS 2017 Ready