Kendo Validator does not process the required rule as expected for select elements that have the "multiple" attribute.
E.g. consider the following example code:
Action:
If you remove the "multiple" attribute from the example code, validatable.validate() returns false as expected when "Select..." is selected.
[EDIT]
Apologies. I did not include all information requested in the sticky topic, nor did I really ask a question.
The above is true on the following set-up:
Kendo UI version: v2012.3.106
OS: Windows 7
Browsers: Chrome 18.0.1025.11, Internet Explorer 8.0.7601.17514
jQuery version: http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
And I suppose my question would be: Has anyone else here run into this issue and found a robust solution? I am currently investigating some hackish workarounds using the custom rule configuration.
TIA
E.g. consider the following example code:
<
div
id
=
"myform"
>
<
select
name
=
"color"
required multiple>
<
option
value
=
""
>Select...</
option
>
<
option
value
=
"red"
>Red</
option
>
<
option
value
=
"orange"
>Orange</
option
>
<
option
value
=
"yellow"
>Yellow</
option
>
<
option
value
=
"green"
>Green</
option
>
</
select
>
<
button
id
=
"save"
type
=
"button"
>Save</
button
>
</
div
>
<
script
>
$(document).ready(function(){
var validatable = $("#myform").kendoValidator().data("kendoValidator");
$("#save").click(function() {
if (validatable.validate()) {
alert('Valid');
} else {
alert('Not valid');
}
});
});
</
script
>
Action:
- No options are selected (or only "Select..." is selected)
- Click "Save"
- validatable.validate() returns false and "Not valid" shows in the alert box.
- validatable.validate() returns trueand "Valid" shows in the alert box.
If you remove the "multiple" attribute from the example code, validatable.validate() returns false as expected when "Select..." is selected.
[EDIT]
Apologies. I did not include all information requested in the sticky topic, nor did I really ask a question.
The above is true on the following set-up:
Kendo UI version: v2012.3.106
OS: Windows 7
Browsers: Chrome 18.0.1025.11, Internet Explorer 8.0.7601.17514
jQuery version: http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
And I suppose my question would be: Has anyone else here run into this issue and found a robust solution? I am currently investigating some hackish workarounds using the custom rule configuration.
TIA