Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

form action correction #3

Closed
neurobox opened this issue Jul 1, 2015 · 1 comment
Closed

form action correction #3

neurobox opened this issue Jul 1, 2015 · 1 comment
Labels

Comments

@neurobox
Copy link

neurobox commented Jul 1, 2015

Hi I'm a bit of a git noob, but I'll contribute this... The form has appeared to stop working because instead of actually submitting to the same page, e.g. /contact-us/#p01contact, it goes to /#p01contact. I'm not sure what's behind this behavior, but found that it behaves correctly if you replace action="#p01contact" with just action="", which forces a reload of the same page.

@nliautaud
Copy link
Owner

Hi,
You're right, but the anchor is useful as it allow to focus on the submitted form. If it's not off-screen and if you don't have several ones on the same page you can get rid of the action parameter (instead of an empty value). It should be fixed by using the absolute url of the page instead. Something like :

$url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$html  = '<form action="' . $url . '#p01-contact' . $this->id . '" autocomplete="off" ';

Feel free to give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants