JS logic for custom Web Form

I’ve created new web form for Warranty Claim doc (in development mode with fixtures). And I need some js logic like when customer has entered “Serial No” he get information about his warranty status. How I can realized it, which file I should add and where this file should be or maybe I can create html page with this form? Please help.

You’ll need to bind an event to the field you want that does an ajax call (frappe.call should work ) to fetch the information you want and inject it into the fields. You should include it in the js of the web form you’re using and you can do the frappe.call to either a method in frappe.client (frappe.client.get should work, or frappe.client.get_value) or a custom-defined one that’s whitelisted.

Thank for your reply. Yes, I’ve assumed about bind an event but I don’t know how js file should be named and where this file should be. My web form doesn’t have any .py or .js file, only .json in fixtures.

You can put the js file in the same folder as the json, and name it the same. Just make sure to hook into it (unless the framework does that automatically, not sure on this).

1 Like

Thank you very much!

1 Like

No problem, let me know if you need any more help!