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
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.
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.
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
Hi Yogesh,
Where are you having this message ?
At which part of site ?
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
Yogesh, try to add errorMsg attribute to your field.
I dont know how it is going to clear error messages
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
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.is working on a reply...