marmelab / ng-admin

Add an AngularJS admin GUI to any RESTful API
http://ng-admin-book.marmelab.com/
MIT License
3.95k stars 726 forks source link

Extend validation() to support other validation rules. #1277

Closed thachp closed 7 years ago

thachp commented 7 years ago

I would like to extend field validation to support other client-side validation rules from validatejs. How should I best approach this?

For example, I would like to use the numericality validator greaterThan in validatejs in the context of, the current field must have a value greater than another field in the same entity.

In my perfect world, I expect to simply define greaterThan property in the validation object.

 field.validation({
      onlyInteger: true,
      greaterThan:  anotherField
})

Perhaps, we could also add another hook similar to onSubmitError(), but for before sending HTTP requests.

    editionView().onBeforeSubmit([Array|Function])

https://ng-admin-book.marmelab.com/doc/reference/View.html

Kmaschta commented 7 years ago

Hello,

As explained in the README, the GitHub issue tracker is for bugs and enhancement requests. So I close this issue, but feel free to write a question on StackOverflow with the tag ng-admin.

Thanks for using ng-admin!