The case :
案子 :
<form id='frm' name ='frm' action='test.php'>
<div style='display:none'>
<input type='text' name='name' value ='' />
</div>
<input type='submit' value='Submit' />
</form>
For example , How can i submit the from given above with its inputs ? Issue : The "name" input wont be passed !
例如,我如何提交上面给出的输入?问题:“名称”输入不会传递!
5 个解决方案
#1
6
Programatically, you can just trigger the submit
event on the form element:
以编程方式,您可以在表单元素上触发submit事件:
$('#frm').submit();
Edit: Actually, after reading your markup more carefully, you are using an input
named name
, this element can cause "*ing" problems with the form's name attribute.
编辑:实际上,在仔细阅读标记后,您使用的是名为name的输入,此元素可能会导致窗体的name属性出现“冲突”问题。
Consider changing the name of your input.
请考虑更改输入的名称。
See also:
也可以看看:
- Unsafe Names for HTML Form Controls
- HTML表单控件的不安全名称
#2
3
As a user, you'd just click the submit button. The visibility of a form element doesn't change the fact that it gets submitted with the form.
作为用户,您只需单击“提交”按钮即可。表单元素的可见性不会改变它随表单提交的事实。
Programmatically:
编程方式:
document.getElementById('frm').submit();
#3
2
If you're not trying to show the input, why not use type="hidden" and dispense with the style?
如果您不想显示输入,为什么不使用type =“hidden”并省去样式?
#4
1
document.getElementById('frm').submit();
。的document.getElementById( 'FRM')提交();
#5
1
Here is how to submit hidden variables in a FORM:
以下是如何在FORM中提交隐藏变量:
<input type='hidden' name='name' value ='' />
#1
6
Programatically, you can just trigger the submit
event on the form element:
以编程方式,您可以在表单元素上触发submit事件:
$('#frm').submit();
Edit: Actually, after reading your markup more carefully, you are using an input
named name
, this element can cause "*ing" problems with the form's name attribute.
编辑:实际上,在仔细阅读标记后,您使用的是名为name的输入,此元素可能会导致窗体的name属性出现“冲突”问题。
Consider changing the name of your input.
请考虑更改输入的名称。
See also:
也可以看看:
- Unsafe Names for HTML Form Controls
- HTML表单控件的不安全名称
#2
3
As a user, you'd just click the submit button. The visibility of a form element doesn't change the fact that it gets submitted with the form.
作为用户,您只需单击“提交”按钮即可。表单元素的可见性不会改变它随表单提交的事实。
Programmatically:
编程方式:
document.getElementById('frm').submit();
#3
2
If you're not trying to show the input, why not use type="hidden" and dispense with the style?
如果您不想显示输入,为什么不使用type =“hidden”并省去样式?
#4
1
document.getElementById('frm').submit();
。的document.getElementById( 'FRM')提交();
#5
1
Here is how to submit hidden variables in a FORM:
以下是如何在FORM中提交隐藏变量:
<input type='hidden' name='name' value ='' />