I have a form that needs a date. I'm using pickadate.js to help users pick a date for an appointment, this field is required. I'm using parsley.js to validate the form and check the required fields.
When I choose a date with the pickadate ui it puts the date into it's box, but parsley doesn't instantly update the UI to reflect the change. As in, if i've tried to submit the form with the date field empty, the date field is invalid and colored red. Then I pick the date, the date is written into the field but the field stays red. When i then click the submit button, the field goes green.
For other fields without the pickadate complication parsley updates their UI instantly giving good feedback to the user.
I've been reading the documentation for each library and trying to combine the features i think will resolve the issue. So far i've tried the following but no luck:
reduced HTML:
<form class="parsley-validate">
<input type="date" class="datepicker-appointmentdate" required>
<input type="submit" value="submit">
</form>
JS:
$('.parsley-validate').parsley();
$('.datepicker-appointmentdate').pickadate({
onSet: function(context) {
$( '.parsley-validate' ).parsley( 'validate' );
}
})
My JS level isn't advanced so I don't mind if anyone feels the need to suggest further reading.
Just to be clear, parsely.js is working perfectly (instantly) for the other fields in the form.
Aucun commentaire:
Enregistrer un commentaire