jQWidgets Forums
jQuery UI Widgets › Forums › Grid › How to set validations for Jqx Date Time input in Jqxgrid?
Tagged: jqx date-time input, jqxgrid
This topic contains 2 replies, has 2 voices, and was last updated by abhishekkkk 10 years, 3 months ago.
-
Author
-
Hi ,
I am using jqx date-time input within jqxgrid in my application.Here, I want to put validation that user shouldn’t be able to select the previous date ie user cannot select any date less than today’s date.Can anyone please suggest how can I achieve this?
Thanks and regards,
AbhishekHi Abhishek,
This is demonstrated in this demo: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/cellediting.htm?arctic
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comThanks for your reply Peter.I tried implementing the solution suggested in above link.However,whatever,value I select,I get the same error message “Entered value is not valid”.i have used below code for the same.
{text: ‘Job End Date’, cellsalign: ‘left’,columntype: ‘template’, width: ‘205px’,cellsrenderer:cellsrendererEndDate,datafield: ‘jobEndDate’,
createeditor: function (row, cellvalue, editor, cellText, width, height) {
// construct the editor.
/* editor.jqxDropDownList({
checkboxes: true, source: getEditorDataAdapter(‘productname’), displayMember: ‘productname’, valueMember: ‘productname’, width: width, height: height,
selectionRenderer: function () {
return “<span style=’top:4px; position: relative;’>Please Choose:</span>”;
}
}); */// editor.jqxDateTimeInput(/* {width: ‘100px’, height: ’25px’} */);
editor.jqxDateTimeInput({ formatString: ‘dd-MMM-yyyy’ });},
validation: function (cell, value) {
if (value == “”)
return true;var year = value.getFullYear();
alert(year);
if (year >= 2015) {return { result: false, message: “Ship Date should be before 1/1/2015” };
}
return true;
},initeditor: function (row, cellvalue, editor, celltext, pressedkey) {
// editor.jqxDateTimeInput({ formatString: ‘dd-MMM-yyyy’ });
//alert(cellvalue);
editor.val(cellvalue);
},
geteditorvalue: function (row, cellvalue, editor) {
// return the editor’s value.
return editor.val();
alert(editor.val());
}
}Can you please look into this once and suggest why I am getting this error.Also,what is the value for ‘year’ variable.I want to avoid previous date selection.
Thanks ,
Abhishek -
AuthorPosts
You must be logged in to reply to this topic.