tags:

views:

29

answers:

3

I have made a personality test users can fill in. (Its in dutch, find it here: http://www.schoolvoorontwikkeling.nl/contact/nieuwe-test ) It consists of about 15 multiple choice questions. At the bottom is a submit button, and it is rather far down. When the user clicks it he is redirected to a page that displays his "score" which is basically a rather long description of his personality type, based on the answers.

Now while this is all working swimmingly, what I cannot seem to figure out, is that as soon as the user clicks the submit button and lands on the 'score' (which is a php script that calculates the user score) page, he lands on the same coordinate as the submit button was on the previous page. Which is effectively in the middle of his personality type description.

I would like him to land at the top of the new page, off course, so he can read his description from the beginning, without first having to scroll up. I have tried making the submit button an anchor, but this does not seem to work. Can anyone help me with this?

+1  A: 

set an anchor at the top of the results page <a id="pagetop"></a> then on the submitted form action <form action="results.php#pagetop"> might work,

Luke

Luke
I was just typing this very thing.
cam8001
+1  A: 

Try <form action="/whatever/is/in/your-address.something#top">
#top should land on the page top.

Edit: note that with this solution you don't need an anchor with id top.

cypher
Nice, I was unaware you could do this.
Luke
Thanks, seems like a good solution, but does not work when I do it.I am wondering if whetehre the fact that I am using a joomla site with a wrapper around the test has anything to do with it.
Jelmar
A: 

The results of the test should have different URL than the test, e.g.:

http://www.schoolvoorontwikkeling.nl/contact/nieuwe-test for the test

and

http://www.schoolvoorontwikkeling.nl/contact/nieuwe-test/result for results

And you should use JavaScript and AJAX to see result on the test page without redirection, it'll load the results and it's easy to move to the top of the page using JavaScript.

It's probably not what you expected, but in my opinion, it's the right solution. The test and result are two different pages and should have two different URLs. AJAX and JavaScript will make it display on the same page, if you don't want redirection.

tomp