ERPNext Foundation ERPNext Cloud Chat Blog Discuss Frappé* Donate

How to create a custom html form in a template (.html) file


#1

How to create a custom html form in a template (.html) file and submit it to server for processing the data For example:
form action="{ what should I write here}" method=’‘POST’ enctype=‘multipart’’
input type=’‘text’’ …

form


#2

Some brief on the use-case please. What is the problem you are trying to solve?


#3

Dear @umair Thank You for replying,
I want to create a simple html form in any of files under (templates/pages/filename.html)
After that I want to submit this form to a server side script.
Here I am facing two problems.

  1. I have created some files in (templates/pages) directory but how to use these files ? as I receive page
    did not found error when I type in browser (192.168.1.111/myfilename).
  2. How to submit the form data to server script ? can I use concept like php form submission ?

I shall be very thankful to you.
Best regards.


#4

Hi, to submit the form you can use the form action way, but we suggest to use the REST API.

You can capture the form values in JS and then use

frappe.call({
  method: 'your.server.side.method',
  args: { form: values },
  callback: function(r) {
    console.log(r)
  }
})