I am trying to get a required field validator working with a grid dropdown. I cannot get the error message to show. Has anyone done something like this? Here is an code example of how I defined the field in my datasource model.
DestinationCountry: {
defaultValue:{Name: "", CountryId: null},
validation: {
custom: function(input) {
// set the custom message
var boundTo = input.data("bind");
if (typeof boundTo != "undefined" && boundTo == "value: DestinationCountry"){
input.attr("data-custom-msg", "Please select Country");
var isValid = (input.val() != "" && input.val() > 0);
if (!isValid){
alert("Please select Country");
}
return isValid;
} else {
return true;
}
}}}
DestinationCountry: {
defaultValue:{Name: "", CountryId: null},
validation: {
custom: function(input) {
// set the custom message
var boundTo = input.data("bind");
if (typeof boundTo != "undefined" && boundTo == "value: DestinationCountry"){
input.attr("data-custom-msg", "Please select Country");
var isValid = (input.val() != "" && input.val() > 0);
if (!isValid){
alert("Please select Country");
}
return isValid;
} else {
return true;
}
}}}