Date Validation
Posted: 12 Sep 2017
I am trying to validate that a Kendo DateTime field is not blank and don't seem to be able to get the code right-
On the OnClick JS of the save button I have tried: -
1)
fd.onsubmit(function() {
var dateTimeofCall = fd.field('Start_x0020_Date_x0020__x0026__x').value();
// Date & Time of Call Validation
if (dateTimeofCall == '') {
alert("The Date & Time of the Call is required");
return false;
}
return true;
});
The above saves the form and does not alert even if the Date & Time field is blank
2)
fd.onsubmit(function() {
var dateTimeofCall = fd.field('Start_x0020_Date_x0020__x0026__x').value([0]);
// Date & Time of Call Validation
if (dateTimeofCall == '') {
alert("The Date & Time of the Call is required");
return false;
}
return true;
});
Option 2 throws a console error from plumsail.fd.kendo.js of - Object doesn't support property or method 'substr'
All I simply want to do is prevent the save function and show an alert if the field is empty or if not save the form?
All help greatly appreciated.
Thanks
On the OnClick JS of the save button I have tried: -
1)
fd.onsubmit(function() {
var dateTimeofCall = fd.field('Start_x0020_Date_x0020__x0026__x').value();
// Date & Time of Call Validation
if (dateTimeofCall == '') {
alert("The Date & Time of the Call is required");
return false;
}
return true;
});
The above saves the form and does not alert even if the Date & Time field is blank
2)
fd.onsubmit(function() {
var dateTimeofCall = fd.field('Start_x0020_Date_x0020__x0026__x').value([0]);
// Date & Time of Call Validation
if (dateTimeofCall == '') {
alert("The Date & Time of the Call is required");
return false;
}
return true;
});
Option 2 throws a console error from plumsail.fd.kendo.js of - Object doesn't support property or method 'substr'
All I simply want to do is prevent the save function and show an alert if the field is empty or if not save the form?
All help greatly appreciated.
Thanks