jQuery UI Widgets › Forums › Grid › Validation on grid.
This topic contains 10 replies, has 2 voices, and was last updated by Dimitar 11 years, 4 months ago.
-
AuthorValidation on grid. Posts
-
Hi
How can i validate Decimal / Floating point number validation on my geig.
I have tried with following javascript.But it does not work out.
validation: function (cell, value) { var RE = /^\d*\.?\d*$/; if(RE.test(value)){ return true; } return { result: false, message: "Invalid Quantity" }; }
This is what i tried.
Eg: 54 -> true 1.235 -> true 12.258 -> true 1.2.5 -> false sdf123 -> false
Is it possible on this grid?
Any one please tell me how can i possible this?
Hello plgeda,
Here is how to achieve the validation:
validation: function (cell, value) { if (typeof parseInt(value) != "number" || value % 1 != 0) { return { result: false, message: "Invalid Quantity" }; }; return true;}
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Thank you Dimitar
But it fails all my requirements.
It doesn’t perform any of validations those i mensioned in my question.
Thanks,
Can anyone please help me?
Hi plgeda,
I am sorry for the misunderstanding. Please try this solution:
validation: function (cell, value) { if ((value / 1) != (value / 1)) { return { result: false, message: "Invalid Quantity" }; }; return true;}
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Sorry Dimitar..
This also does not work for me..
Thank you…
Hi plgeda,
As I understand it, if you type:
1) integer (54) -> true;
2) decimal (1.235, 12.258) -> true;
3) string like 1.2.5 -> false;
4) any other string (sdf123) -> false.At our side, the solution we provided you returns the same values for the different cases.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/In my side..
2ed scenario does not work for me.. decimal (1.235, 12.258) .Other casues are fine.
it does not return anything such as true or false.
Here is my other codes related to this column.
{ name: 'qty', type: 'number' }, { text: 'Qtuanty', datafield: 'qty', width: 90, minwidth: 90,sortable:false, validation: function (cell, value) { if ((value / 1) != (value / 1)) { return { result: false, message: "Invalid Quantity" }; }; return true; } },
please tell me what is worng in these statements.
Thanks.
Please any one tell me..did i do anythindg wrong in these statements?
Hi plgeda,
There seems to be nothing wrong with your code. Please tell us what browser you are using and its version and also make sure you have the latest version of jQWidgets (3.0.4).
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.