NYCPHP Meetup

NYPHP.org

[nycphp-talk] Valudating common field types

Konstantin K kkrutoi at gmail.com
Mon Oct 26 16:06:25 EDT 2009


be careful. don't just check if the field is NON empty.  that's not good
enough.

in English, you can reasonably assume the following to be true about names:
- must contain at least 1 letter [A-Za-z]
- may contain ' (apostrephe) and - (dash) and  (space)
- shouldn't be longer than 40 characters.
- should not contain #s, or any other symbol, especially < (so ppl don't
start entering html codes, js, etc)

Konstantin





On Mon, Oct 26, 2009 at 3:48 PM, David Krings <ramons at gmx.net> wrote:

> Yogesh Agashe wrote:
>
>> Hello,
>>
>>
>> This is my first post to this NYPHP mailing list. So hello to everyone and
>> thanks for the thorough discussions which help a beginner developer like me.
>>
>
> Welcome, was the same with me, except that I never really left beginner
> stage.
>
>
>
>  > Is there any other way to validate first and last names. It will be nice
>
>> to have have inbuilt function for such commonly used field types. I will
>> like to know how people tackle these issue.
>> Thanks.
>>
>>
> The only thing I would check is that the fields are not empty. The maximum
> length is set via the maxlength parameter in HTML and everything else
> qualifies as  a valid name. I don't think you can reasonably script
> validation to make sure that the first name entered is "Dirk" and not
> "Dork".
>
> David
>
> _______________________________________________
> New York PHP Users Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> http://www.nyphp.org/Show-Participation
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20091026/9d04301b/attachment.html>


More information about the talk mailing list