jQuery UI Widgets Forums Grid Vaidation on number column

This topic contains 12 replies, has 2 voices, and was last updated by  ivailo 9 years, 4 months ago.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
  • Vaidation on number column #71457

    flehmann
    Participant

    Hi all,

    I have an editable grid with a number column.
    When the user enters an invalid string instead of a number, the string is converted to 0 and no error is given to the user.
    So the user might accidently enter and save the incorrect value 0.
    The validation callback already has the new value of 0 , so I cannot react correctly there.
    I also cannot use the geteditorvalue function, because I am using a different localisation which is not yet interpreted in geteditorvalue.

    So how can I either prevent the change to 0 or give a valid error message?

    Thanks in advance

    Vaidation on number column #71467

    ivailo
    Participant

    Hi flehmann,

    You can set columntype: 'numberinput'. This will prevent entering of any incorrect string values.

    Look at this fiddle.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

    Vaidation on number column #71471

    flehmann
    Participant

    Thanks,

    The customer really dislikes the numberinput control.
    Also the number of decimals varies from time to time so that is not an option.
    Any other possibility?

    Vaidation on number column #71474

    ivailo
    Participant

    Hi flehmann,

    You can customize the numberinput control with createeditor function, so the customer “do not feels it like a numberinput”.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

    Vaidation on number column #71479

    flehmann
    Participant

    How can I set the numberinput to allow any number of decimals?

    Vaidation on number column #71515

    ivailo
    Participant

    Hi flehmann,

    You can use decimalDigits property about these purposes.
    Here is a fiddle.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

    Vaidation on number column #71549

    flehmann
    Participant

    Hi Ivailo,

    Thanks for your reply, but I was asking about ANY number of decimals.
    The customer does not want to be restricted to 2 or 4 or whatever number.
    He just wants to be able to enter any number with any decimals. But he also needs a validation error in case he does enter an invalid string.
    And converting data to 0 without further notification is a big no-go that really alerted many people.

    Thanks for your help.

    Vaidation on number column #71569

    ivailo
    Participant

    Hi flehmann,

    In this case the solution is to use regular input plus regex validation.

    Here is the fiddle.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

    Vaidation on number column #71576

    flehmann
    Participant

    That sounds promising, but when I use this combined with localization (german) it gets really crazy:

    http://jsfiddle.net/h2kkh438/1/

    Now when I can enter neither “12,3” nor “12.3”
    It seems the validation method still uses the english input, but afterwards there is some other kind of validation that leads to the error “Entered value is not valid” which is not the error message we defined.

    Any help on that?

    Vaidation on number column #71582

    ivailo
    Participant

    Hi flehmann,

    When you have to change the localization, you must set the regex for the allowed symbols.
    Also in this case to use toString method to convert the value.

    Here is the fiddle.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

    Vaidation on number column #71585

    flehmann
    Participant

    Hi,

    We are getting close, but still…
    Now the basic validation (remember, thats what it is all about) is not working anymore.
    I can enter “asd” it gets converted to “0” and I wont have any validation for it.

    I am really sorry, but thats what I am fighting with for days…

    Vaidation on number column #71635

    flehmann
    Participant

    Hi Ivailo,

    Any news on this issue?

    Vaidation on number column #71638

    ivailo
    Participant

    Hi flehmann,

    Unfortunately there is no option for covering all requirements that you have.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.