Copied to clipboard

Flag this post as spam?

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


  • yogesh pathak 136 posts 221 karma points
    Jun 05, 2015 @ 08:33
    yogesh pathak
    0

    Clear Validation error message

    Hi all,

    How can i clear "Property has errors" validation message by code?

    OR how can i clear all validation Errors?

    any help?

    Thanks

    Yogesh

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Jun 11, 2015 @ 09:47
    Alex Skrypnyk
    0

    Hi Yogesh,

    Where are you having this message ?

    At which part of site ?

  • yogesh pathak 136 posts 221 karma points
    Jun 11, 2015 @ 10:03
    yogesh pathak
    0

    Hi Alex, Actually i have created a custom grid editor which have a field named "Header" , for this text input i have made its ng-required property true so when i used to click on save and publish without entering any values to it it shows a validation message "Property has errors" . now i want to clear this validation message on a click on button, how can i do this?

    and answer to your question- I am having these messages at the top of content creation page

    Regards Yogesh Pathak

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Jun 11, 2015 @ 10:38
    Alex Skrypnyk
    0

    Yogesh, try to add errorMsg attribute to your field.

  • yogesh pathak 136 posts 221 karma points
    Jun 11, 2015 @ 10:54
    yogesh pathak
    0

    I dont know how it is going to clear error messages

  • Abdul Rahim 21 posts 83 karma points
    Jul 01, 2015 @ 11:39
    Abdul Rahim
    0

    Hi

    @Yogesh

    I have same issue when creating a validation for avoid duplicate Nodes. I was created a hidden field and give required for that field. But don't need display error message if I set null value to that control thorugh my angular custom controller.

    Please help

    Rahim

  • Dimitri Troncquo 4 posts 26 karma points
    Aug 17, 2020 @ 10:20
    Dimitri Troncquo
    0

    Very late to the party, but as I struggled with this myself and documentation is quite scarce I'll just add my two cents.

    Validation in custom property editors uses the validation infrastructure provided by Angularjs (as far as I know this is version 1.1.15); so I suggest you read up a bit on how this works.

    Basically, validation is triggered as the input changes (so as you type, click, whatever ...). You can use built-in validators of angularjs. That means things like required, type="number", etc. are supported out of the box. When you need more advanced validation, I suggest you write your own directive. Umbraco does have a kind of "generic validation" directive (val-property-validator) but I personally have not been able to get this to work properly.

    Angularjs has a nifty $scope.$watch function, which allows you to bind to a property (could be anything, for example a property in your model, the isvalid property of your component's scope, an array, a function, ...), which triggers a function when the bound value changes. I found this to be extremely useful.

    Now coming back to hiding your custom messages. I spent lot of time trying to figure out if there is a 'validation changed' event I could subscribe to or something of that nature, sadly there isn't, or at least I couldn't find it. BUT, Umbraco adds a show-validation css class to the main property form once you have pressed "Save (and/or publish)". You can simply leverage this by adding something like this to you component's css, and applying the correct classes to your messages.

    .my-validation-summary {
        display: none;
    }
    
    .show-validation .my-validation-summary {
        display: block;
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft