From dd2bc1eca8f892fba51859e495e456979b74e2d9 Mon Sep 17 00:00:00 2001 From: Rolf Schmidt Date: Fri, 16 Oct 2020 16:53:24 +0200 Subject: [PATCH] Follow up - 45f56b0d7c8f1a2c543f56c0277bc44d582926b0 - Fixed missing html 5 checks for generic create and edit dialogs. --- .../controllers/_application_controller_generic.coffee | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/assets/javascripts/app/controllers/_application_controller_generic.coffee b/app/assets/javascripts/app/controllers/_application_controller_generic.coffee index 4a94a6df5..60e0a0a4b 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_generic.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_generic.coffee @@ -22,6 +22,11 @@ class App.ControllerGenericNew extends App.ControllerModal object = new App[ @genericObject ] 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 errors = object.validate() if errors @@ -70,6 +75,11 @@ class App.ControllerGenericEdit extends App.ControllerModal params = @formParam(e.target) @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 errors = @item.validate() if errors