05-17-2008, 02:37 AM
|
#2 (permalink)
|
|
The Acquainted
Join Date: Nov 2007
Posts: 154
Thanks: 31
|
No, what you want to do is use JavaScript and the DOM to evaluate that input before the form is submitted, possibly even as they are typing. If there are errors, use the JS DOM functions to manipulate elements on the page, show error messages, etc. Then if the form values are acceptable, allow the form to be submitted to the PHP script handling the input and check the values again. This ensures the user doesn't 'get around' your client side validation by disabling JavaScript. For those that do have JS enabled, their experience is much easier and doesn't require a page load just to check for valid input.
I don't know if 'shaking' the field is a great idea, I tend to avoid all the fancy animations these frameworks allow. Your web application should degrade gracefully and work identically for those users that have JS disabled, have an older or different browser, etc. So giving the user feedback on what's wrong with their input can be identical whether done via JS or PHP.
__________________
I reject your reality, and substitute my own.
|
|
|
|