Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jason Espin 368 posts 1335 karma points
    Dec 02, 2014 @ 15:07
    Jason Espin
    0

    Umbraco Validation Attributes plugin does not work in Umbraco 7.1.9

    Hi all,

    For some time now I have been using the fantastic Umbraco Validation Attributes by Warren Buckley ( https://github.com/warrenbuckley/Umbraco-Validation-Attributes ) so that I can use dictionary values in my MVC forms for labels and validation.

    This is all well and good but since version 7.1.9 of Umbraco this package no longer seems to work. I know that it's core dependencies are on version 7.1.6 and I was recently told during a hangouts session with Sebastiaan Janssen that it's a good idea to update these dependencies using NuGet so that they match the version of Umbraco I am currently using. This is all well and good for some reason now my code does not seem to work.

    Has anyone else has any issues with this plugin and the latest version of Umbraco?

    My model is as follows:

    public class NewsletterModel
        {
            [UmbracoEmail(ErrorMessageDictionaryKey = "Newsletter.Error.Email")]
            [UmbracoRequired("Newsletter.Error.Required")]
            [UmbracoDisplayName("Newsletter.Email")]
            public string EMAIL { get; set; }
    
            [UmbracoRequired("Newsletter.Error.Required")]
            [UmbracoDisplayName("Newsletter.Forename")]
            public string MMERGE4 { get; set; }
    
            [UmbracoRequired("Newsletter.Error.Required")]
            [UmbracoDisplayName("Newsletter.Surname")]
            public string LNAME { get; set; }
        }
    

    And my view is as follows:

    @using (Html.BeginUmbracoForm<NewsletterController>("Submit"))
    {
        <div class="form-group clearfix">
            @Html.LabelFor(model => model.EMAIL, new { @class = "control-label col-md-3" })
            <div class="col-md-9">
                @Html.TextBoxFor(model => model.EMAIL, new { @class = "form-control input-sm", aria_required = "true", required = "true", type = "email", placeholder = "[email protected]" })
            </div>
    
            @Html.ValidationMessageFor(model => Model.EMAIL)
        </div>
        <div class="form-group clearfix">
            @Html.LabelFor(model => model.MMERGE4, new { @class = "control-label col-md-3" })
            <div class="col-md-9">
                @Html.TextBoxFor(model => model.MMERGE4, new { @class = "form-control input-sm", aria_required = "true", required = "true" })
            </div>
    
            @Html.ValidationMessageFor(model => Model.MMERGE4)
        </div>
        <div class="form-group clearfix">
            @Html.LabelFor(model => model.LNAME, new { @class = "control-label col-md-3" })
            <div class="col-md-9">
                @Html.TextBoxFor(model => model.LNAME, new { @class = "form-control input-sm", aria_required = "true", required = "true" })
            </div>
    
            @Html.ValidationMessageFor(model => Model.LNAME)
        </div>
        <div class="form-group clearfix">
            <div style="position: absolute; left: -5000px;"><input type="text" name="code" tabindex="-1" value=""></div>
            <div class="col-md-12">
                <button type="submit" class="btn btn-default btn-warning pull-right">
                    @UmbracoValidationHelper.UmbracoHelper.GetDictionaryValue("Buttons.Submit")
                </button>
            </div>
        </div>
    }
    

    The main issue I am having so far is that my field labels are not displaying despite there being values present for these dictionary fields.

    Any help would be greatly appreciated.

  • Dmitriy Larionov 10 posts 30 karma points
    Jan 26, 2015 @ 11:15
    Dmitriy Larionov
    0

    And in 7.2.1 it does not works also. May be somebody solved this, but we don't know?

  • Jason Espin 368 posts 1335 karma points
    Jan 29, 2015 @ 12:15
    Jason Espin
    0

    I've raised the issue with Warren via GitHub and a number of people have raised the same issue so I think he is going to be looking into it shortly.

  • Craig Cronin 304 posts 503 karma points
    Apr 22, 2015 @ 11:07
    Craig Cronin
    1

    Has anyone come across a solution for this, just moved back to this part of my application and its causing issues again...aaarrggghhhhh

  • Bendik Engebretsen 105 posts 202 karma points
    May 03, 2017 @ 16:24
    Bendik Engebretsen
    0

    It would be really nice to have this plugin back for Umbraco >= 7.5. Actually, it would be even better if Umbraco itself supported all the validation attributes of MVC with a dictionary key added.

    Or is there maybe a better way of solving this nowadays?

Please Sign in or register to post replies

Write your reply to:

Draft