frappe.ready(async function() {
frappe.web_form.after_load = () => {
console.log(‘hello’);
}
});
My above code is not working in Webform js file.
frappe.ready(async function() {
frappe.web_form.after_load = () => {
console.log(‘hello’);
}
});
My above code is not working in Webform js file.
Hi @Sufyan_Sadiq,
I am not familiar with the webform script, but if you haven’t checked, please refer to the documentation for assistance.
Thank You!
Hi @Sufyan_Sadiq , I experience the same issue.
If in my web form .js file (e.g. customer_request.js) I use the following, the first part runs and it effectively shows “Test if this runs” in the console, but I can´t make the part of the after_load run.
frappe.ready(function () {
console.log("Test if this runs");
frappe.web_form.after_load = () => {
console.log("Test of after load in JS file");
};
});
However, if in the Client Scripting part of the Web Form (within Desk) I add the following, it works:
frappe.web_form.after_load = () => {
console.log("Test of after load from within the Client Script of the Web Form");
};
Inside the js file and within the frappe.ready, I have been able to run this (replace <my_field_name> with the technical name of your field:
frappe.ready(function () {
frappe.web_form.on(“<my_field_name>”, (field, value) => {
console.log(value);
});
}
it gets executed when the chosen field is changed.
I would be super grateful if you or anybody could help me here run the after load from within the JS file.
In the documentation I find a bit confusing this part:
which indicates
frappe.web_form.after_load = () {
// init script here
}
https://frappeframework.com/docs/user/en/web-form/customization#trigger-script-when-form-is-loaded
which, on the other hand, shows:
frappe.web_form.after_load = () => {
// init script here
}
In the latter I assume it´s actually:
frappe.web_form.after_load = () => {
// init script here
}