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

Posted by william.clarke on 08/17/06 22:52

Chris wrote:
> Dear Rude Rik,
>
> First, I am not a 'Dude', and second, I posted this particular message here
> to confirm that, contrary to some previous remarks, JS and PHP can be used
> together to validate forms. I was not asking for help with the JS portion,
> only noting that the PHP works on my code, but the JS doesn't in spite of
> the fact that it works fine on the example. I posted the code only for an
> example of what it looked like. If you insist on being rude, please do not
> respond to my messages.
>
> Chris

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:

1. PHP can output the validation JavaScript to make it semi-dynamic (eg
check for a specific value based on a database field etc.)
2. JavaScript validation can stop a response being sent back to the
server (so PHP validation will not occur.)
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)

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

 

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

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