Browse Source

工具表单增加buildSuccessScript方法

jqh 5 years ago
parent
commit
240ccad7df
1 changed files with 20 additions and 0 deletions
  1. 20 0
      src/Widgets/Form.php

+ 20 - 0
src/Widgets/Form.php

@@ -595,11 +595,31 @@ HTML;
             <<<JS
 $('#{$this->getElementId()}').form({
     validate: true,
+    success: function (data) {
+        {$this->buildSuccessScript()}
+    },
+    error: function (response) {
+        {$this->buildErrorScript()}
+    }
 });
 JS
         );
     }
 
+    /**
+     * @return string|void
+     */
+    protected function buildSuccessScript()
+    {
+    }
+
+    /**
+     * @return string|void
+     */
+    protected function buildErrorScript()
+    {
+    }
+
     /**
      * @param array $input
      *