Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Thomas Kahn 602 posts 506 karma points
    Sep 11, 2009 @ 14:53
    Thomas Kahn
    0

    A numeric field get's emptied if something other than digits are entered - validation doesn't work.

    I've added a numeric field on one of my document types. This is not a mandatory field so the mandatory checkbox is not checked. But I've added a regular expression to validate that only numeric values are added - found it on the net: ^[1-9]+[0-9]*$.

    If the user enters a non-numeric value like "123abc" into the field, I expected the regular expression to kick in with a warning.

    What happens is that Umbraco saves and publishes the page and the numeric field is emptied(!)

    I'm not sure if this is a bug, but from a user point of view this behavior is kind of erratic.

    /Thomas Kahn
    umbraco v 4.0.2.1 (Assembly version: 1.0.3441.17657)

  • dandrayne 1138 posts 2262 karma points
    Sep 11, 2009 @ 15:01
    dandrayne
    0

    This appears to be correct - I didnt check if the non-numeric value was actually published on the site though.

    What you could do is change it to textstring and set validation like

    ^[0-9]+$

    As this definitely doesnt publish if validation is not matched. 

  • Thomas Kahn 602 posts 506 karma points
    Sep 14, 2009 @ 10:15
    Thomas Kahn
    0

    I tried switching to your new regexp, but the result is the same: the field is emptied and Umbraco reports no error if the field contains anything but digits. If I check the mandatory box for the doctype Umbraco informs me that I need to fill in the required field and the field is emptied.

    Should this be reported as a bug at Codeplex or not? As I said, I'm not sure if it's a bug or not.

  • dandrayne 1138 posts 2262 karma points
    Sep 14, 2009 @ 10:48
    dandrayne
    0

    The above comment was regarding a textstring field - I can confirm what you are seeing with a numeric field.  I'd file it as a bug on codeplex - even if it is expected behaviour it will be marked as such.

  • Thomas Kahn 602 posts 506 karma points
    Sep 22, 2009 @ 21:58
    Thomas Kahn
    0

    I've submitted an issue on codeplex just to be sure. Thanks dandrayne!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies