I am working on a form that I would like to be able to show errors on. Say for example they don't fill in the correct answer in one Input... when they click Submit, I run PHP to get $_Post and then if there is an error I catch it and tell them. Right now I tell them at the top of the page, however, I would like to highlight the inputbox or even the div where the error occered. In PHP do I catch all the problems and store them in vars then display them in a form rewritten? Can I use JS such as the Prototype library to SHAKE the incorrect answer area?
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.
lets say if js is disabled for a user and they go ahead and fill out the form and submit the page and i have a die or exit function that dies and displays them a message of what they mistyped or something. is there a better way to represent the data rather than showing them a blank white page with a die message?
sarmenhb> You shouldn't kill the script and just show the user a blank page, your script should handle errors and bad data gracefully. If your script incorporates the user entry form, then add some logic that still shows the form but displays a relevant error that they can correct. If the script is separate and simply handles the input, use a header() call to redirect back to the form page, passing an error handling action in the URL query string.