Closed shankumars closed 8 years ago
If you are using Parsley 2.x you must use data-parsley-required
.
Hi thank you for reply.... but still it not working me.....
<label class="col-sm-4" for="particulars_to" > Create Using</label>
<div><input type="radio" name="particulars_to" id="particulars_to1" class="select" value="0" checked="checked"> <label for="particulars_to1" class="icheck_label">All</label></div>
<div><input type="radio" name="particulars_to" id="particulars_to2" class="select" value="1" > <label for="particulars_to2" class="icheck_label">Admission No</label></div>
<br>
<div id="admission" style="display:none">
<label for="admission_no" class="req">Student No</label>
<input type="text" id="admission_no" name="admission_no" class="form-control" >
</div>
$('.select').click(function(event){
if($(this).val() == 0){
$('#admission').css('display', 'none');
$('#admission_no').attr('data-required', 'false');
}
if($(this).val() == 1){
$('#admission').css('display', 'block');
$('#admission_no').attr('data-parsley-required', 'true');
}
});
Here when I select second option radio button, the script code will trigger and the attribute also added but the validation is not working..... It was an option and attribute add through script. If you can not understand please reply me.... else give some solution.
thanks Kumar Shanmugam
I've got the same problem. I manually add required
attribute only when user selected a certain option. I'm using parsley.js with Step Form Wizard, and i need to validate manually added required
before user moves to next step.
For the scenario when there is a validation error showing and myinput
is no longer required, then parsley needs to be called somehow.
The best way is probably to $myinput.trigger('input')
, basically faking that the user has modified that input. If there's an error showing, validation will be redone.
Closing this, please provide CodePen if there's still an issue.
New version of parsley.js(2.3.6) did the trick. It works ok, now.
Hi I am using the parsley validate plug-in to validate my form. But when I am add the attribute ' data-required="true" ' manually through jquery based on the radio button option select by client.
please any one help me or guide me right path for this problem.
thanks Kumar Shanmugam