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)
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.
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.
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)
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
As this definitely doesnt publish if validation is not matched.
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.
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.
I've submitted an issue on codeplex just to be sure. Thanks dandrayne!
is working on a reply...