I also attached an anchor to the form action so when the page reloads to show any errors they are kept in view instead of the page going back to the top and thus the visitor would not see the errors.
action="/contact.php#error"
So far this all works fine.
Now, using an .htaccess file I’m removing the file extension and adding a trailing slash.
The problem is when the .htaccess file is added to the mix, it causes the toggle to open on load and remain open. I thought it might have to do with the anchor but that doesn’t seem to be it. Ideas?
That doesn’t sound like anything that the htaccess could affect, not unless the JavaScript is reading the hash from the page and using that to decide whether or not to show the DIV.
Could you try setting action=“/contact/#error” and see if that works? Then you could rule out the htaccess, because you’re simply setting the URL to what the redirect is doing anyway…
Walter
On Feb 14, 2012, at 12:06 PM, Todd wrote:
I have a link that toggles an initially closed form (jQuery).
I also attached an anchor to the form action so when the page reloads to show any errors they are kept in view instead of the page going back to the top and thus the visitor would not see the errors.
action="/contact.php#error"
So far this all works fine.
Now, using an .htaccess file I’m removing the file extension and adding a trailing slash.
The problem is when the .htaccess file is added to the mix, it causes the toggle to open on load and remain open. I thought it might have to do with the anchor but that doesn’t seem to be it. Ideas?
Could you try setting action=“/contact/#error” and see if that works? Then you could rule out the htaccess, because you’re simply setting the URL to what the redirect is doing anyway…
That was my thinking too and I tried it earlier but oddly it didn’t work. I must be missing something obvious.
I don’t know anything about how the jQuery library works internally, but I don’t see anything about this that would indicate that this is your problem directly. Do you get an error in your JavaScript console when you click?
(Those are all the same URL, really, but Apache content negotiation is filling in the gaps here. I’m not using your htaccess per se, but it’s a very similar thing.) Note that I am explicitly canceling the click with preventDefault(), returning false is belt and suspenders. Prototype’s Event.stop() does both.
Walter
On Feb 14, 2012, at 2:08 PM, Todd wrote:
It appears the problem is this:
Without .htaccess the toggle link looks like this,
Thanks for the examples. I got it sorted out (mostly) except for one issue.
[See the code I posted earlier in the thread for specifics]
What’s odd is there are 8 otherwise identical forms (each with different ids) that work but this last one doesn’t. Instead of the form reloading to the error anchor it goes to the top of the page.
Here’s the difference I’m seeing:
If I submit an empty form the errors come up as expected and the url looks like this:
http://somesite.com/who.php#form1error
This is good.
But the bad form looks like this:
http://somesite.com/who.php#form2error%20method=
I don’t know why the “%20method” part is being tacked on. PHP or javascript?