瀏覽代碼

工具表单增加buildSuccessScript方法

jqh 5 年之前
父節點
當前提交
240ccad7df
共有 1 個文件被更改,包括 20 次插入0 次删除
  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
      *