I have list of options and I have to valid that at least there should be 4 options.
I have paste part of that form below:
<form class="custom-validation repeater" method="post" id="livechatform" enctype="multipart/form-data" action="/admin/poll/create">
<div class="col-10">
<input class="form-control" name="options[]" type="text" required>
</div>
<div class="d-flex flex-wrap gap-2 mt-3">
<button type="submit" class="btn btn-primary waves-effect waves-light">
Submit <span class="spinner-border spinner-border-sm"></span>
</button>
<button type="reset" class="btn btn-secondary waves-effect">
Cancel
</button>
</div>
</form>
And I have written jquery as below:
$("#livechatform").validate({
rules:{
options[]: {
required: true,
minlength: 4
}
},
messages: {
options[]: {
required: "Please enter at least 4 options",
minlength: "Please enter at least 4 options"
}
},
submitHandler: (form)=> form.submit();
})
But It is not working. can someone help me How to valid that ?