In the past I have been a big proponent if leveraging the database
constraints in form validation logic, which is what CayenneForm is all
about. However, I find in practice the field level database contraints
are quite limited, i.e. mandator status and field length, and your
applicaiton needs to provider additional constraints, i.e. a email
VARCHAR(50) column should use a EmailField to apply the email address
validation rules.
Even things like column mandator status aren't always useful in real
life, as objects often go through a lifecycle where they pick up
information, so you can even make many columns mandator because in
some scenarios they aren't, while in other scenarios they become
mandator.
How you should go about building your validation rules really depends
upon the problem you are solving. If its a well defined and
constrained application, I would tend to put my validation logic in
the Pages and maybe use custom Fields classes which have extended
valdiation logic, if there is opportunity for reuse.
If the problem is more generic, I think there is merit in looking at a
more meta-data driven validation model, where the business tier
exposes the validation constraints, which are applied in the UI tier.
The thing to keep in mind here is the cost/benefit, i.e. don't build
something you aint going to need.
regards Malcolm Edgar
On Mon, Aug 11, 2008 at 1:36 PM, Alexandre Jacques <
dev.lists@...> wrote:
> Hi,
>
> What would be the best approach for advanced validation? I mean, checking if
> fields are populated are quite simple with Click default validation but
> requirements are more complicated than that. I need to go to the DB to check
> some more stuff before accepting the form.
>
> Is there something built-in on Click to ease my life?
>
> Regards,
>
> Alexandre Jacques
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
>
http://moblin-contest.org/redirect.php?banner_id=100&url=/> _______________________________________________
> Click-user mailing list
>
Click-user@...
>
https://lists.sourceforge.net/lists/listinfo/click-user>
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
Click-user mailing list
Click-user@...
https://lists.sourceforge.net/lists/listinfo/click-user