2 messages in com.googlegroups.pylons-discussRe: Rails like "validation" feature?| Subject: | Re: Rails like "validation" feature?![]() |
|---|---|
| From: | frooyo (fro...@yahoo.com) |
| Date: | 09/27/2006 01:33:17 PM |
| List: | com.googlegroups.pylons-discuss |
frooyo wrote:
In rails, there exists this feature where you can bind an object to an action such that, if for example - someone submit a web form, you can programatically require that certain fields are non-empty and match a given criteria (e.g. only digits).
Does Pylons have this type of ability?
In rails, I believe the code would look something like this:
class User < ActiveRecord::Base validates_presence_of :username, :message => 'is required' validates_presence_of :email, :message => 'is required' end
Which would require a "username" and "email" and if not present, an error message would be displayed saying that it "is required".
I'll answer my own question.
It appears that Pylons uses FormEncode for form validation.
http://pylonshq.com/docs/0.9.2/form_handling.html
I have never used FormEncode before and am still determining whether or not it's as easy to use as the Rails example above.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to pylo...@googlegroups.com
To unsubscribe from this group, send email to
pylo...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/pylons-discuss
-~----------~----~----~----~------~----~------~--~---




