Follow up - 45f56b0d7c - Fixed missing html 5 checks for generic create and edit dialogs.

This commit is contained in:
Rolf Schmidt 2020-10-16 16:53:24 +02:00 committed by Martin Edenhofer
parent 45f56b0d7c
commit dd2bc1eca8

View file

@ -22,6 +22,11 @@ class App.ControllerGenericNew extends App.ControllerModal
object = new App[ @genericObject ] object = new App[ @genericObject ]
object.load(params) object.load(params)
# validate form using HTML5 validity check
element = $(e.target).closest('form').get(0)
if element && element.reportValidity && !element.reportValidity()
return false
# validate # validate
errors = object.validate() errors = object.validate()
if errors if errors
@ -70,6 +75,11 @@ class App.ControllerGenericEdit extends App.ControllerModal
params = @formParam(e.target) params = @formParam(e.target)
@item.load(params) @item.load(params)
# validate form using HTML5 validity check
element = $(e.target).closest('form').get(0)
if element && element.reportValidity && !element.reportValidity()
return false
# validate # validate
errors = @item.validate() errors = @item.validate()
if errors if errors