I have a contact form set up with Freeform and when having inline errors, I would like to return to an anchor on the page, since my form is on the bottom of the page.

I tried setting inline_error_return="#contact-form", but it doesn't even add the hash to the url.

Hope someone can help me out.

up vote 2 down vote accepted

I think inline_error_return is the way to go, but maybe you need a complete url there, not just the anchor. In a recent site I did, I have inline_error_return="{page_url}/#job-apply-form" which works.

  • Yes, you need the URL or segments as well as the anchor in inline_error_return="", eg. inline_error_return="template_group/template#anchor". Keep in mind that the page is reloaded with the inline errors, so the anchor behaviour is a bit different from the classic way of clicking a link going to an anchor on the same page. – Solspace Jan 28 '14 at 17:50
  • Yes that works, thanks! – Joan Jan 28 '14 at 19:26
  • A really late addition - You can use inline_error_return="{current_url}/#anchor" too. Handy if your form is outside the channel entries loop. – SamC May 30 '14 at 21:18

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.