jQuery UI Widgets Forums Grid Validation on grid.

This topic contains 10 replies, has 2 voices, and was last updated by  Dimitar 6 years, 8 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
  • Validation on grid. #31696

    plgeda
    Participant

    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?

    • This topic was modified 6 years, 8 months ago by  plgeda.
    • This topic was modified 6 years, 8 months ago by  plgeda.
    • This topic was modified 6 years, 8 months ago by  plgeda.
    Validation on grid. #31738

    plgeda
    Participant

    Any one please tell me how can i possible this?

    Validation on grid. #31747

    Dimitar
    Participant

    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,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Validation on grid. #31850

    plgeda
    Participant

    Thank you Dimitar

    But it fails all my requirements.

    It doesn’t perform any of validations those i mensioned in my question.

    Thanks,

    Validation on grid. #31856

    plgeda
    Participant

    Can anyone please help me?

    Validation on grid. #31871

    Dimitar
    Participant

    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,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Validation on grid. #31907

    plgeda
    Participant

    Sorry Dimitar..

    This also does not work for me..

    Thank you…

    Validation on grid. #31909

    Dimitar
    Participant

    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,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Validation on grid. #32143

    plgeda
    Participant

    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.

    • This reply was modified 6 years, 8 months ago by  plgeda.
    • This reply was modified 6 years, 8 months ago by  plgeda.
    • This reply was modified 6 years, 8 months ago by  plgeda.
    Validation on grid. #32220

    plgeda
    Participant

    Please any one tell me..did i do anythindg wrong in these statements?

    • This reply was modified 6 years, 8 months ago by  plgeda.
    Validation on grid. #32372

    Dimitar
    Participant

    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,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.