i have a text input component which has a validator input prop for field level validation which gets triggered by event like clicking the field. I am using the text-input component multiple times in a form. How do i trigger field level validation for all text-inputs on form submit.
我有一个文本输入组件,其具有用于字段级验证的验证器输入道具,其由诸如单击该字段的事件触发。我在表单中多次使用文本输入组件。如何在表单提交上触发所有文本输入的字段级验证。
<form id="update-for-homeaddress" action="/mycontact" method="POST" onSubmit={this.handleSubmit}>
<Label labelFor="Nickname" labelText="Nickname:" required/>
<TextInput inputName="Nickname"
inputType="text"
value={this.props.myhomeaddress.AddressAlias}
onChange={()=>{}}
validator={ValidateFactory.getMandatoryCheck()}
ref="TextInputRef"
/>
1 个解决方案
#1
0
I suggest moving this code into a tag below. Put an ID in the form tag
我建议将此代码移到下面的标签中。在表单标记中添加ID
then using this
然后用这个
$('document').ready(function()
{
//Jquery validation codes
$("#my_form").validate({
submitHandler: submitForm
});
function submitForm()
{
//Submit form from here
}
}
You need the jquery validation plugin here, you can add different validations then on
您需要此处的jquery验证插件,然后您可以添加不同的验证
I hope this helps in any way.
我希望这有助于任何方式。
#1
0
I suggest moving this code into a tag below. Put an ID in the form tag
我建议将此代码移到下面的标签中。在表单标记中添加ID
then using this
然后用这个
$('document').ready(function()
{
//Jquery validation codes
$("#my_form").validate({
submitHandler: submitForm
});
function submitForm()
{
//Submit form from here
}
}
You need the jquery validation plugin here, you can add different validations then on
您需要此处的jquery验证插件,然后您可以添加不同的验证
I hope this helps in any way.
我希望这有助于任何方式。