Thoughts on QuickForm-additions (again)
| From: | Stefan Neufeind | Date: | Fri, 15 Aug 2003 07:40:22 +0000 |
| Subject: | Thoughts on QuickForm-additions (again) | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-19799@lists.php.net to get a copy of this message | ||
Hmm - again seems like some topics are simply being lost on this list
these days. Well, maybe there has too much discussion about the
"secondary maintainer"-thing and similar topics so that some people
simply stoped listening.
But I'd like to try again and politely ask for your comments on this
proposal to QuickForm
------- Forwarded message follows -------
From: "Stefan Neufeind" <stefan@neufeind.net>
To: pear-dev@lists.php.net
Date sent: Wed, 13 Aug 2003 10:38:15 +0200
Copies to: Bertrand Mansion <bmansion@mamasam.com>
Priority: normal
Subject: [PEAR-DEV] Thoughts on QuickForm-additions
[ Double-click this line for list subscription options ]
Just a quick note for the public (and maybe for discussion):
Been talking to Bertrand Mansion (one lead of HTML_QuickForm) I
proposed
a) addition of a new regex for validating numericals with up to two
decimals. b) functions to validate a minValue and a maxValue for
numerical input fields.
In detail:
a) one example of such a regex allowing 0, 1 or 2 decimals would be:
/^(([0-9]+)|([0-9]+\.[0-9]{1,2}))$/)
The dot in this example could automatically be adjusted to fit the
locale setting of php, which might make it quite handy. Bertrand
responded to use registerRule during QuickForm-runtime to register a
new rule for this. That's something I intended to do for the moment.
But the basic idea was if numbers with up to two digits are commonly
used (e.g. for quantity or monetary values) and if such a type might
be a general enhancement so people don't need to find that regex
themselves, but can assume it just exists.
b) Currently there are minLength and maxLength refering to string-
length, which can easily be implemented via regex. This is however
not
possible for minValue and maxValue refering to the numerical value.
Bertrand pointed out correctly that it possible to write your own
function for server-side-validation of a numerical value and that if
you supply a JavaScript-function on your html-page with the same name
this function would also be used for client-side-validation. I just
thought having minValue and maxValue in QuickForm might be a good
idea
so that people don't need to write 2 functions (server-side and
client-side) on their own, since I believe these value-bounds are
also
commonly used. Another point that doesn't make comparing the value
entered in the form with a min/max-value that easy is that in e.g. in
Germany a comma is used as the decimal point. For validation with
JavaScript this would have to be converted to a dot before
comparisons. The same applies to server-side. For the server-side
validation Bertrand proposed to use the Validate- package which, as
he
said, already handles locale settings for the decimal separator.
So the question is whether people will implement such functionality
on
their own every time they might need it or if these are such
elementary features that they should be added.
Your comments are very much appreciated. Please comment.
Stefan
--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
------- End of forwarded message -------