jQuery UI Widgets Forums Grid custom validation in cellendedit event

This topic contains 3 replies, has 2 voices, and was last updated by  Dimitar 12 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

  • Rakesh
    Member

    Dear,

    I need to perform custom validation in cellendedit event like if my cell value, which is entered by user is more that 5 i need to show error message.

    For this i wrote following code in cellendedit, but its not triggering

    if (args.value>5)
    return [false, \”Please try again\”];

    Its not showing error message.
    I need to highlight that cell and its not allowing to go until change the cell value.


    Dimitar
    Participant

    Hello Rakesh,

    You may use the validation callback function, instead of cellendedit. E.g.:

                      { text: 'Price', datafield: 'price', align: 'right', cellsalign: 'right', cellsformat: 'c2', columntype: 'numberinput',
    validation: function (cell, value) {
    if (value < 0 || value > 15) {
    return { result: false, message: "Price should be in the 0-15 interval" };
    }
    return true;
    },

    The code snippet is from the demo Editing.

    Best Regards,
    Dimitar

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


    Rakesh
    Member

    ya.

    I have done that. but I am doing some functiality here.

    So my functionality is in cellendedit event and my columns will come dynamically.

    let me know solution for any one of following issues.

    1. validation and need to do modify previous cell value based on current cell.

    2. how to give validation for dynamic columns. and I am changing columns on button click event. So my columns may vary. In that case how can i give validation.

    Regards,
    Siva


    Dimitar
    Participant

    Hi Siva,

    Please post your page source code so that we may be of help.

    On a side note, I assume the forum topic validation for dynamic columns is about the same thing. I suggest the discussion continues here.

    Best Regards,
    Dimitar

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

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

You must be logged in to reply to this topic.