[英]Form submit button not working with AngularJs
I've a problem with my form. 我的表格有问题。 I want to make standard PHP form but AngularJS is blocking the "Submit" button.
我想制作标准的PHP表单,但AngularJS阻止了“提交”按钮。
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>
This issue pops up in different cases: 在不同情况下会弹出此问题:
required
attribute for validation. required
属性。 send
your data. send
数据之前隐藏表单元素。 name
attribute. name
属性。 input
does not have a name
attribute. input
没有name
属性。 You can try to add a name
attribute to your submit input: 您可以尝试在提交输入中添加
name
属性:
<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>
Try adding name
attribute in input tag. 尝试在输入标记中添加
name
属性。 Only form elements with a name attribute will have their values passed when submitting a form. 只有具有name属性的表单元素才会在提交表单时传递其值。
<input type="submit" value="Send" name="send">
Hope this solves your problem. 希望这能解决你的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.