Re: Do you validate your forms with javascript or php?
"Chung Leong" <chernyshevsky@hotmail.com> wrote in message
news:09adnfesd9w2qkPcRVn-1w@comcast.com...
> "Tony Marston" <tony@NOSPAM.demon.co.uk> wrote in message
> news:crl96r$ivg$1$8300dec7@news.demon.co.uk...
>>
>> "Chung Leong" <chernyshevsky@hotmail.com> wrote in message
>> news:VLydnXNMgeHOeEDcRVn-jQ@comcast.com...
>> > Personally, I dislike how client-side validation is usually
>> > implemented.
>> > That is, using alert boxes.
>> >
>> > *** dong! ***
>> >
>> > A good approach I think is to use Javascript to check for missing
>> > fields
>> > and
>> > use PHP to validate what's actually entered. It's more consistent,
>> > since
>> > there could be fields that can only be validated on the server-side
> (e.g.
>> > duplicated user name). The server can also consolidate and format the
>> > error
>> > messages better.
>>
>> I disagree completely. All data MUST be validated on the server
>> (including
>> missing fields) regardless of any EXTRA validation performed on the
>> client
>> using javascript. This prevents any checks from not being performed
>> simply
>> because the client has disabled javascript.
>>
>> Your remark about error messages is also rubbish as ANY message you can
>> create using javascript you can also create on the server. You do NOT
>> need
>> javascript to create sexy error messages.
>>
>
> Next time when you disagree with me completely, can you at least read my
> post first?
Your remark "A good approach I think is to use Javascript to check for
missing fields and use PHP to validate what's actually entered" implies that
you use PHP to validate what is entered and javascript to validate what is
*not* entered. My second remark was wrong as I misread what you had written
(I mentally substituted 'client' for 'server').
Tony Marston
|