I am building a simple Grid control and I wondered if it was possible to make any of the fields "Required" ?
If it is possible does anyone have any sample code to put validation into the grid?
The trick is to give the element (field) a unique ID, and you can then check whether that element has some of the classes added by Angular during validation.
Grid control validation
Hi,
I am building a simple Grid control and I wondered if it was possible to make any of the fields "Required" ? If it is possible does anyone have any sample code to put validation into the grid?
Thanks
Jon
Hi Jonathan,
Umbraco uses Angular for validation, so the fields will be required if you add a
required
attribute - eg:Alternatively you can use
ng-required
instead to use a condition - if a setting telling whether the field you in fact be required.That is great - how do you set a Required warning next to the correct field in the Grid?
A required field will get a red border if you hit Save, and the field doesn't have a value. Is that sufficient?
Otherwise it gets a bit more complex. I did this for one of my packages - you can see that here:
https://github.com/skybrud/Skybrud.ImagePicker/blob/master/src/Skybrud.ImagePicker/App_Plugins/Skybrud.ImagePicker/Directives/ImagePicker.js#L23
The trick is to give the element (field) a unique ID, and you can then check whether that element has some of the classes added by Angular during validation.
Fantastic - thanks again for all your help
:)
is working on a reply...