Make AngularJS custom Datatype honour mandatory setting
I am creating a custom datatype with AngularJS and want it to honour the "Field is Mandatory" setting of the DocType it is on.
How do I tell Umbraco that the datatype is invalid (i.e. not filled in)?
The datatype consists of a text input and a number input. The number input will default to "0" which is OK, but I need to ensure the text field is not empty ... if the "Field is mandatory" checkbox is ticked on the DocType.
Make AngularJS custom Datatype honour mandatory setting
I am creating a custom datatype with AngularJS and want it to honour the "Field is Mandatory" setting of the DocType it is on.
How do I tell Umbraco that the datatype is invalid (i.e. not filled in)?
The datatype consists of a text input and a number input. The number input will default to "0" which is OK, but I need to ensure the text field is not empty ... if the "Field is mandatory" checkbox is ticked on the DocType.
On your controller side :
You can check this code and the $scope.validateMandatory
https://github.com/umbraco/Umbraco-CMS/blob/5397f2c53acbdeb0805e1fe39fda938f571d295a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/colorpicker/colorpicker.controller.js
this function is called from that directive val-property-validator="validateMandatory"
https://github.com/umbraco/Umbraco-CMS/blob/5397f2c53acbdeb0805e1fe39fda938f571d295a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/colorpicker/colorpicker.html
is working on a reply...