Custom script on web form

Can we have custom scripts on web forms?

1 Like

No currently not.

I guess It’s right that custom scripts are not available for web forms but I think we can write javascript there as when we select the form as standard, three files are created - .js, .json and .py.
I want to know how we can show data from another doctype in that webform?

1 Like

Is this problem solved?
I made a web form and trying to populate the data to child table of that web form. I find no help from frappe documentations. There is no option to write custom script for web forms.
Does anyone know about this?
Any kind of help would be fruitful.
Thank you.

1 Like

Has anyone learnt how to script webforms the way we do std doctypes yet?

You can put custom script in the Website > Web Form > Client Script section (below the fields section)

Or use the py and js files of the doctype used to create the webform.

This feature newly available in version 13 beta.

And what I wonder is why we can not use the js file of the webform itself.
Always gets error when put this file in the hooks web_include_js.

The error is:
AttributeError: 'set' object has no attribute 'startswith'

Even an empty js file hooked in web_include js raise error.

EDIT: My bad… I use {} instead of [] for the web_include_js. It works in app_include_js and doctype_js, but not in web_include_js.