jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Server side column validation?
Tagged: server side validation, validation
This topic contains 6 replies, has 4 voices, and was last updated by admin 9 years, 11 months ago.
-
Author
-
Hi all,
I have been using jqwidgets for my online web application, it is awesome!!!!
I’m wondering if there is possible to do server side column validation i.e. there is a value which must not be empty :validation: function (cell, value) { if (value == "") { return { result: false, message: "Must not be empty!" }; } return true;}
which works fine. BUT : can I do some server side checking i.e. if there is already a record in the mysql table (check for a duplicate and alert when yes)????
Thank you in advance.
Best regards,
ViktorI’d appreciate if someone could direct me to the right place in this issue…. Thanks!
Hi Victor,
You can make synchronous Ajax call in the column’s validation function and return true or false depending on whether the validation passes or not. Another approach is to do the validation in the source object’s updaterow callback where you sync the updated row with the server and call commit(true) or commit(false) if the validation fails.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi victor,
i have command button(Edit) in my grid and when click on that button row become editable. I make ajax call to update row in db and some reason this ajax call fails. i want this row in edit mode and show validation failure msg near that column.
Is it possible??Please refer following js fiddle link.
<li>http://jsfiddle.net/chaitanya21/vfms29ma/10/</li>
Hi Chaitanya,
You have showvalidationpopup method in jqxGrid which you can use for that purpose. Example is available on the Grid’s API Documentation page.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
Thanks..
but how we can make row editable in updaterow method, if error occur in ajax call.`updaterow: function (rowid, rowData, commit) {
if (flag == true) {
commit(true);
} else {
$(“#jqxgrid”).jqxGrid(‘beginrowedit’, rowid); //here we dont have row number, rowid not working.
commit(false);
}
},Hi Chaitanya,
This is wrong approach. You should not call methods for begin edit within methods which are called when the edit has finished. I suggest you to think more how to do your task. Also beginrowedit requires Row’s Bound index, not the Row ID.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.