form action attribute not working (giving 404 error)

254 views
Skip to first unread message

Mohamed Ben Othman

unread,
Apr 7, 2023, 6:13:14 AM4/7/23
to Google Apps Script Community
Simple form with action attribute:
<form action="submit_form.html" method="get">
  <label for="name">Name:</label>
  <input type="text" id="name" name="name"><br><br>
  <label for="email">Email:</label>
  <input type="email" id="email" name="email"><br><br>
  <label for="message">Message:</label><br>
  <textarea id="message" name="message" rows="4" cols="50"></textarea><br><br>
  <input type="submit" value="Submit">
</form>

whatever I put in the file submit_form.html it give a 404 error. The file is added to the project correctly.
Thank you to lead me as I am new in apps script.

Nerio Villalobos

unread,
Apr 11, 2023, 4:21:20 AM4/11/23
to google-apps-sc...@googlegroups.com
The issue might be related to the fact that you are using an HTML form to submit data to a standalone HTML file (submit_form.html) which might not be available in the expected location. Here are some things you can check to fix the issue:

Make sure that the submit_form.html file exists in the same directory as the HTML file that contains the form.

Double-check the file name and extension. Make sure that the file name and extension are correct and match the name and extension of the file you are trying to access.

Check the file permissions. Make sure that the file permissions are set correctly and that the file is accessible to the public.

Verify the URL. Make sure that the URL in the action attribute of the form is correct and that it points to the correct location of the submit_form.html file.

Assuming that the submit_form.html file exists in the same directory as the HTML file containing the form, you can try to change the action attribute of the form to "./submit_form.html" which specifies a relative path to the file. Alternatively, you can use an absolute path to the file if you know the exact location of the file. For example, if the submit_form.html file is located in the root folder of your project, you can use the following action attribute: "/submit_form.html".

Once you have fixed the issue, the form should be able to submit data to the submit_form.html file without any error.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/5468108b-8cd1-41ca-9f96-43be9b9a981en%40googlegroups.com.


--
__________________________
Nerio Enrique Villalobos Morillo
Buenos Aires, Argentina
Reply all
Reply to author
Forward
0 new messages