1

I've a problem with my form. I want to make standard PHP form but AngularJS is blocking the "Submit" button.

When I click the "Submit" button, it returns some errors in console. And remember I don't want to dynamically submit.

The error is:

An invalid form control with name='' is not focusable.

This example

<body ng-app="mainApp">
    <form action="post.php" method="post">
        <div ng-controller="MainCtrl">
            <label for="titlex">Title</label>
            <input id="titlex" class="form-control" type="text" maxlength="75" min="10" name="titlex" required>
        </div>
        <input type="submit" value="Send">
    </form>
</body>
2
  • Did you try to add a name attribute to the button? <input type="submit" value="Send" name="send"> Commented Feb 18, 2018 at 0:22
  • 1
    Really thank you so much. I did what you said and the button worked. I can not believe it's that simple. I've been trying for almost 2 hours :) Commented Feb 18, 2018 at 0:31

2 Answers 2

2

This issue pops up in different cases:

  • You have a hidden form element that has a required attribute for validation.
  • You hide an form element before send your data.
  • Some required form elements does not have a name attribute.
  • Your submit input does not have a name attribute.

You can try to add a name attribute to your submit input:

<input type="submit" value="Send" name="send">

or you can setup your form to be not validated by the browser mechanics by using

<form name="myform" novalidate>
Sign up to request clarification or add additional context in comments.

Comments

1

Try adding name attribute in input tag. Only form elements with a name attribute will have their values passed when submitting a form.

<input type="submit" value="Send" name="send">

Hope this solves your problem.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.