0

I’m trying to have a javascript function run AFTER a form has been submitted and validated. When I use onSubmit, the function runs regardless. The basic HTML5 validator (For example the REQUIRED tag) does not run.

When I remove the onSubmit, the HTML5 validator works perfectly, showing a message if a required field is blank.

I would like the function to be run only after a successful submission, where the required fields are filled in.

Here is my current code:

<form id="form" method="POST" action="//api.cloudstitch.io/test/test/datasources/sheet" class="form" onSubmit="goPush()" >
  <div class="form-group">
    <label><b>First Name </b></label>
    <input name="FirstName" class="form-control">
  </div>
  <div class="form-group">
    <label><b>Last Name </b></label>
    <input name="LastName" class="form-control" required >
  </div>
  <div class="form-group">
    <input type="submit">Submit</input>
  </div>
</form>

Any ideas?

Thanks!

Updated:

Here is the function that’s being run on the onSubmit.

 <script>
var goPush = function(){parent.window.myhypedocument.showSceneNamed(‘mycard');};
    </script>

Thanks for the help!

0 Answers0