BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
The code for the drop-down list control is as follows:
<ej-drop-down-list id="KeyList" datasource="Model.Keys" ej-for="KeyId" watermark-text="Select Key" >
<e-drop-down-list-fields value="Id" text="TypeNavigation.Description" />
</ej-drop-down-list>
The code for the autocomplete control is as follows:
<input type="hidden" asp-for="Username" required="required" />
@{Html.EJ().Autocomplete("selectAssignee")
.Width("205")
.Datasource(Model.Users)
.MultiSelectMode(MultiSelectModeTypes.None)
.FilterType(FilterOperatorType.Contains)
.AllowGrouping(false)
.HighlightSearch(false)
.AutocompleteFields(e => e.Text("Identifier")
.Key("Username")).Render();
}
The jquery function that performs the validation is written as follows:
$("#issue-key-form").validate({
errorElement: "div",
errorPlacement: function (error, element) {
error.appendTo("div#errors");
},
// Specify the validation rules
rules: {
selectAssignee: "required",
KeyList: "required"
},
// Specify the validation error messages
messages: {
selectAssignee: "Please select a recipient for the key",
KeyList: "Please select a key"
},
submitHandler: function (form) {
form.submit();
}
});
However, when I submit the form with the autocomplete field empty and no value from the drop-down list selected, only the validation for the autocomplete field is picked up.
Does anyone know what I might be doing wrong?
Thanks,
Seán
<code>
$(" #issue-key-form").validate({
ignore: [],
errorElement: "div",
errorPlacement: function (error, element) {
error.appendTo("div#errors");
},
// Specify the validation rules
rules: {
selectAssignee: {
required: true
},
KeyList: {
required: true
}
},
// Specify the validation error messages
messages: {
selectAssignee: "Please select a recipient for the key",
KeyList: "Please select a key"
},
submitHandler: function (form) {
form.submit();
}
});
</code> |
<code>
$("#myform").validate({
ignore: ":hidden:not([name='KeyList'])",
………..
});
</code> |