On Thu, Oct 1, 2009 at 5:45 PM, Sophie <kfarron...@gmail.com> wrote:

>
> IS_MATCH('[a-zA-Z]+',error_message='Only charaters allowed')
>

This reads:

any string of one or more of any combination of upper or lower case
letters...

>
> This works but if i want to add spaces, for las name for example: De
> La Rosa


> How can i do this?
>

You can group regular expressions, e.g.:

([A-Z][a-z]*[ ]*)+

You can test the results with tools, e.g. http://www.pythonregex.com/


>
> On 1 oct, 16:46, mdipierro <mdipie...@cs.depaul.edu> wrote:
> > This:
> >
> > requires=[IS_NOT_EMPTY('Please insert a country name'),
> > IS_UPPER(), IS_NOT_IN_DB(db,'Country.nCountry','This country is
> > already in the database')],
> >
> > should already do what you asked as long as you do not have already
> > data in the DB.
> >
> > You can add one more validator instead
> > IS_MATCH('[a-zA-Z]+',error_message='Only charaters allowed')
> >
> > What about Cote' d'Ivoire?
> >
> > On Oct 1, 4:11 pm, Sophie <kfarron...@gmail.com> wrote:
> >
> >
> >
> > > Hi there my problem is when i validate my input, i have this code in
> > > the model
> >
> > > db.define_table("Country",
> > >     Field("nCountry", "string", default=None, label="Name",
> > > notnull=True, requires=[IS_NOT_EMPTY('Please insert a country name'),
> > > IS_UPPER(), IS_NOT_IN_DB(db,'Country.nCountry','This country is
> > > already in the database')], ondelete='CASCADE'))
> >
> > > So when i start inserting data i have duplicate data like this:
> > > Brazil, BRazil, BRAzil, braZil.
> >
> > > This is the same country, but is written in different ways. There is a
> > > way to validate this?
> >
> > > The other problem i have is that i can insert Br4zil, but i want it to
> > > receive only alphabetical inputs.
> >
> > > Well thats all thanks a lot.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to