When using a MultiSelectFor, I am having a problem with kendo validator if there is already a value in the model for that multiselect.
For example:
Below is the code for the MultiSelectFor. On my form I am checking to see if a property of a model exists, if so I am adding the validator with the message "Required" to it. It is my understanding that this should only occur if the multiselect is empty. Attached is a picture of the required validator showing when there is a selection in the multiselect. The problem is when there is an initial value on the first load, after that it works as intended where it is removed when a value is selected and is shown when there is no value.
In the attachment you will see that it is only this multiselect that has a problem. everything else works fine with an initial value.
How do I go about making sure that if there is an initial value that the validator is not shown? Is there an event that fires after the value is populated so that I can run a validation function to clear out the validation?
01.validateForm: function() {02. var validator = $('#' + this.formName).kendoValidator({03. messages: {04. required: "Required"05. }06. }).data("kendoValidator");07. 08. if (validator != null)09. return validator.validate();10. else return null;11.}
@(Html.Kendo().MultiSelectFor(m => m.SelectedResources).DataTextField("Text").DataValueField("Value").Placeholder("No Resources Selected").DataSource(source => { source.Read("ReadActiveUsers", "_System");}))