You are here: Re: Form validation with PHP/Javascript « PHP Programming Language « IT news, forums, messages
Re: Form validation with PHP/Javascript

Posted by Jerry Stuckle on 08/18/06 00:59

william.clarke wrote:
>
>
> Hi Chris,
>
> Can I try to clear something up here, Javascript and PHP validation are
> two mutually exclusive activities, the only ways they relate to each
> other are:
>

PMJI, William,

No they aren't mutually exclusive. You can do one, the other or both.
Personally, I prefer the both alternative. Validate on the client if JS
is enabled. And validate everything on the server.

> 1. PHP can output the validation JavaScript to make it semi-dynamic (eg
> check for a specific value based on a database field etc.)

Sure. JS is just text, after all.

> 2. JavaScript validation can stop a response being sent back to the
> server (so PHP validation will not occur.)

Yes, if HS is enabled. But even if it is validate by JS (or JS is
disabled), the PHP will still validate it on the server.

> 3. JavaScript can also be used to initiate and listen for AJAX
> communications to a PHP page. (May be used for validation, but is often
> used for dynamic sorting or additional information display)
>

True, but also depends on JS.

> My advice with the JavaScript side of things is make it work by hand in
> Firefox (about 90% of the time if it works here it will work in Opera,
> IE and Safari). Then include the working JavaScript in the PHP you are
> using to generate your page . If the JavaScript now stops working, view
> the client-side page source, not the server-side, to see what's wrong.
> Often having a look at the JavaScript Console in FireFox will give you
> a few pointers with JavaScript faults. Once you figure out what is
> wrong with the generated html, update the server-side source to stop
> the problem from being regenerated.
>
> Hope this helps
>
> William
>

Good advice.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация