0 votes
by (330 points)

I want to have a form submission that is a little more streamlined than the "prompt" macro in Harlowe so I was wondering if anyone had any experience with form submissions through Twine before. This is the example I'm working with:

<!DOCTYPE html>
<html>
<body>

<p>Enter names in the fields, then click "Submit" to submit the form:</p>

<form id="frm1" action="/action_page.php">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br><br>
  <input type="button" onclick="myFunction()" value="Submit">
</form>

<script>
function myFunction() {
    document.getElementById("frm1").submit();
}
</script>

</body>
</html>

 

2 Answers

0 votes
by (2.7k points)

Hi silamander,

could you check out

http://twinery.org/questions/881/a-way-to-have-a-text-box-on-the-page-rather-than-an-input-box?show=881#q881

That is an example for 1 input field, which actually worked for me (Twine2.2.1/Harlowe2).

Jherek

0 votes
by (159k points)

Is the story HTML file you generated via the Publish to File option being hosted on the same web-server as the action_page.php file?

What type of Response will the web-server be returning? and what do you want the current page of story HTML file to do with that Response.

note: You ideally should include a method attribute on your form element, so there is no confusion about if it's a POST or a GET Request. (I am assuming you want to send a POST Request.)

...