|
home—lects—exams—hws
breeze (snow day)
When you find an error:
perhaps set a global flag,
and print a specific error message.
Javascript: you can
To avoid repeated code: Use functions to validate. (One argument will be a string to use in the error output.)
Principle: Make your javacode and php validation code look as similar as possible: same function-names, same approach, same regular expressions, etc.. This way, when you edit/debug one side it's easy to find&fix the corresponding code on the other side.
If you validate input on both client-side and server-side,
how can you tell if it's working?
Use functions, and (on client) a global
(You might also want to print a warning to the html, when validation is turned off so you don't accidentally release them (or turn them in as homework).
Note: How to ssh w/o always typing password: storing a public key in .ssh/.
echo preg_match( '/row/', 'How now, brown cow?' ); echo preg_match( '/r.w/', 'How now, brown cow?' ); echo preg_match( '/n[oe]w/', 'How now, brown cow?' ); echo preg_match( '/rows?/', 'How now, brown cow?' ); echo preg_match_all( '/ow/', 'How now, brown cow?' ); echo preg_match_all( '/rows?/', '\"How now, brown cow?\", he crows.' ); echo preg_match( '/[0-9]*/', '00047' ); echo preg_match( '/\\d*/', '00047' ); echo preg_match( '/[0-9]+/', '00047' ); |
home—lects—exams—hws
breeze (snow day)
©2010, Ian Barland, Radford University Last modified 2011.Feb.11 (Fri) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |