Virtual properties validation

13 views
Skip to first unread message

JB

unread,
Apr 15, 2014, 2:32:55 PM4/15/14
to zena...@googlegroups.com
Hi Gaspard / Zena list!

Making some tests with Zena 1.2.5, it seemed that there is no validation for the virtual properties that we create from the management / properties screen. A user can enter any value, including values out of the range allowed by the field type. 

Explanation:
I created a virtual class "Expense", a role "Record" from which "Expense" depends and 2 properties for the role "Record": "valint" (an integer using idx_integer1) and "value" (a float using idx_float1)
I could enter any value for both fields, without getting any warning.
For example I tried the following:

1. A value of 99999999999999 for the "valint". The value rendered on my pages was 99999999999999. But in the database I could see that the idx_integer1 value from the nodes table was 2147483647 (which looks good for an integer) and the value in the versions table was 99999999999999.

2. A value of 1e100 for the "value" field writes 3.40282e+38 in the idx_float1 field and 1.0e+100 in the versions table and on the screen.

3. A value of 1e10000 for the "value" field writes 3.40282e+38 in the idx_float1 field and "Infinity" in the versions table. This "Infinity" seems to break everything and the error message shows (Sorry... An error prevented the requested page from rendering)

We might get problems due to a difference between values in the node table and values in the version table (maybe?)
Worst is the effect of the "Infinity" value that is really disruptive for a web site..

My question is then: do we have a way to limit the values entered by users? A minimum would be to make sure that a value is in inside the allowed range for the type of the field.
Or is it preferable to use bricks with validation code?

I can send by email the part of the log for that error if necessary.

Thanks!
Reply all
Reply to author
Forward
0 new messages