0

I want to create html form in captivate 9 with action to specific server, when submit button will clicked then it submit all the textbox data to server. please do some help, i am really struggling with it.

Jake
  • 103
  • 6
  • i think you shall be more specific plus try it by yourself first then post some code on here; – L777 Apr 09 '16 at 08:54
  • 1
    What surprises me the most is that this question got two upvotes already. Your code behaves different from what you expected, but how can we fix it if you don't post it? – GolezTrol Apr 09 '16 at 08:55
  • i only want to make sure it is possible or not ? – Jake Apr 09 '16 at 08:57

1 Answers1

0

You can inject an HTML <form> element with an action="..." attribute into your Captivate project with JavaScript.

  1. Set up an element on your slide, to which you would like to inject the <form> into. For example, a simple empty rectangle shape. Assign element ID to it.
  2. Add a JavaScript action to run when somebody enters your slide. In the JavaScript action, you have to select your the “form container element” (by the previously assigned ID) and insert your desired <form> into it.
const formContainer = $('#form_container')
formContainer.html(`
<form action="https://example.org/your-endpoint/" method="post">
    <textarea name="text-entry"></textarea>
    <!-- ... -->
</form>
`)

Unfortunately, Captivate seems to block any submissions when you insert an <button type="submit"> to the injected <form>.

So, what you can do as workaround is creating a button in Captivate and execute a JavaScript, which then submits your form.

Such a JavaScript action for your custom submit button could look something like this:

$('#form_container form').submit()
David Wolf
  • 1,400
  • 1
  • 9
  • 18