I have this following code:
<form action="main.js">
<input type="text" required="required" pattern="[a-zA-Z]+" />
<input type="submit" value="Submit" />
</form>
When i click the submit button, the information that was in the input should be sent to my file "main.js". But there is nothing in "main.js". I want that "main.js" file would contain that passed information as a string, is there a way or method to do this?
Seems like you've understood
form action
incorrectly.Action defines which code will handle your form values, and not which page will the results be pasted into.
you'll want main.js to receive the form results and handle them in a way to be pasted into a results.txt file for example. But allowing a user of your website to create or edit files on your server is insecure.
The only option i think of, unless you have access to server side coding, like php or asp, is sending the submitted form information to your email using mailto:
can you run asp or php?