Merge pull request #10136 from scmmishra/after-load-web-form

This commit is contained in:
Suraj Shetty 2020-04-29 13:20:56 +05:30 committed by GitHub
commit 69fb2db5ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,7 +29,7 @@ export default class WebForm extends frappe.ui.FieldGroup {
// webform client script
frappe.init_client_script && frappe.init_client_script();
frappe.web_form.events.trigger('after_load');
this.after_load && this.after_load();
}
on(fieldname, handler) {
@ -102,7 +102,9 @@ export default class WebForm extends frappe.ui.FieldGroup {
}
save() {
this.validate && this.validate();
if (this.validate && !this.validate()) {
frappe.throw(__("Couldn't save, please check the data you have entered"), __("Validation Error"));
}
// validation hack: get_values will check for missing data
let doc_values = super.get_values(this.allow_incomplete);
@ -134,7 +136,7 @@ export default class WebForm extends frappe.ui.FieldGroup {
if (!response.exc) {
// Success
this.handle_success(response.message);
frappe.web_form.events.trigger('after_save');
this.after_save && this.after_save();
}
},
always: function() {