Reputation: 514
I am using a script called Advanced Poll which is working great. However I have a small "cosmetic" problem, which I cannot solve.
The poll is located on the lower right side of my website. But after someone submits his or her vote, you are pushed back to the top of the page instead of focussing on the poll (lower right).
Normally with normal html you can fix this easily by adding an anchor point and a link, however because this is form, I don't understand how to do it correctly. So it 'reloads' the page back at the poll section after submitting a vote, instead of scrolling down again.
I tried fooling around a bit with the HTML myself, however no luck. It starts back at the top of the website, instead of staying around the poll-area.
I added the code below, above the poll section:
<a name="backtopoll"></a>
And I added:
#backtopoll
to:
<a href="$this->form_forward?action=results&poll_ident=$poll_id" class="link link-indent fright">$pollvars[result_text]</a>
Which results in:
<a href="$this->form_forward?action=results&poll_ident=$poll_id#backtopoll" class="link link-indent fright">$pollvars[result_text]</a>
But that didn't work. As soon as I click on submit vote, my vote is cast and I find myself back at the top of the website again, instead of reloading the page at the poll-section. :(
What am I doing wrong here...?
//update
Adding / changing it to:
<a id="backtopoll"></a>
As Sibu stated, didn't work.
//anotherupdate
Maybe I can do the same with jQuery or JS on the page?
Upvotes: 3
Views: 11761
Reputation: 1
Yes, it is ugly to work with anchors in forms. Working with .focus() lets you position the page much more easily.
Upvotes: -3
Reputation: 514
Nevermind I fixed it myself by using the information described here: Is it possible to add an anchor to a FORM post/get?
<form action="mypage.aspx#MyAnchor">
Upvotes: 6