<form action="" method="POST" id="form" >
<select id="inputCustomerType" class="form-control" name="customer_type" required>
<option value="">Choose...</option>
<option value="select1">Select1</option>
<option value="select2">Select2</option>
<option value="select3">Select3</option>
</select>
<script>
$('#form').parsley();
</script>
<button type="submit" id="updateButton" class="btn btn-primary mt-3" >Update</button>
</form>
i want,
if i change the select option, remove the previous parsley error display messages
and then i click update again check parsley validation and displaying particular field errors
2
Answers
I just changed the button type to "button" to prevent the form from submitting automatically when clicked.
When the button is clicked, we call form.reset() to clear any previous error messages from the form.
Then, we call form.validate() to trigger Parsley validation for the form again. Parsley will display error messages for the currently selected field only.
Below solution work for me, you can check this. you need to handle select change event ‘inputCustomerType’
$(document).ready(function() {
var form = $(‘#myForm’);