SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 221 | Next

Jonathan Snook, Aaron Gustafson, Stuart Langridge, and Dan Webb

"Accelerated DOM Scripting with Ajax, APIs, and Libraries"


The function is also called when the JavaScript starts up from the init() function. This
means that if the PHP code shows an error with the field, the submit button will be immediately
disabled until the error is fixed. Importantly, the button is disabled by JavaScript; if the
button is disabled by the PHP, and JavaScript isn??™t turned on, there is no way to re-enable it.
It??™s important that you maintain this separation between server-side code and client-side
code; don??™t do things on the server that require client-side code to put right or to alter
because they won??™t work in scriptless environments.
Listing 7-4 shows this code in practice, with the (minimal) changes in bold.
Listing 7-4. simple-form-tidier-js-prevent-submission.php
...


A simple PHP form using regular expressions for validation