Page position on POST

Hi guys,

I’ve got a form that’s using


action as to keep the initial page content and form processing together.

My problem is this. The form itself is located at the bottom of page, below the fold so if there are any errors with the form, these errors are displayed out of sight (within a div that contains the form).

In my ignorance I added a


with the location set to an anchor within the page. This however then removes any error confirmation messages as I’m guessing that this function is much like a page refresh.

Is it possible that on ‘submit’ the focus on the page can return to the form so that the user is aware of any messages?

… if that makes sense. :lol:


Use an anchor tag - not the URL kind, the bookmark kind.

<a name=“myform”>

Then tell your form to submit to

(or $_SERVER[‘PHP_SELF’].“#myform” )

PS: REQUEST doesnt contain PHP_SELF, SERVER does.

You know when something is staring you in the face… yeah. :blush:

Implementing the absolute URL with the anchor worked a treat. I’m not sure why I wasn’t using that anyway.

Thanks so much! :slight_smile:

FYI, IE6 (in case you still care about that one) has a bug that it doesn’t jump to the anchor tag when redirected. There’s a fix over here: Internet Explorer 6 and redirected anchor links | Ian Hoar

Ah, I probably would’ve stumbled across that at the last minute during the usual IE bug hunt. Thanks for the heads up, saves me having to ask another question. :wink: