(PHP Form) How to return to the form on error

Hi,

Ive got my form nice and validated and doing everything i want it to but ice got a problem when i hit submit with errors:

It returns me to the page correctly but my form is below the fold and i would like it to return me to exact place of the form… I guess i need to set up some sort of anchor but im not sure how this could be done.

Any ideas?

Thanks

The simplest manor would be to capture the id of an element with focus and append that id to the form action path via JavaScript. The other way is to process and submit the form using AJAX so that the page doesn’t refresh.

im fairly new to Ajax so it wouldn’t really know were to start to do this… Could you point me in the right direction for a simple fix? (if possible)

Thank you.