Frappe CSRF token error when i create custom html form instead of frappe web form. How to submit a custom html form through POST?

308 views Asked by At

I have created an app named 'account'. In that created html form < account/account/www/signup.html >. if I put frappe.csrf_token in my script file. The console printed frappe is not defined.

How to import Frappe in html. I've not found anything related to that.

I have tried

headers: {
    "X-Frappe-CSRF-Token": frappe.csrf_token
},

like that I include the csrf token, but frappe error throws when I submit

frappe.exceptions.CSRFTokenError: Invalid Request
2

There are 2 answers

0
feadrick On

you need to put your code inside frappe.ready function

frappe.ready(() => {
//your code
})
0
Maheshwari Bhavesh On

You need to extend web.html and then override that using your html