Forum

Thread tagged as: Question, Forms

Is it possible to redirect a perch:form to a particular anchor when validation f...

I have a form in the footer of my index page which accepts an email address so users can sign up for my client's newsletter.

I am attempting to use perch's form validation, which is working, but unfortunately when the form is validated and produces an error, my index page simply reloads (and presents the user with the the top of the index page.)

Right now, the perch:error text shows up near the form in the footer (as it should) but the user would very likely assume that the form was submitted correctly, even when it wasn't, since it appears to just redirect them to the homepage, and they wouldn't be presented with the error text.

I know I could just put the perch:error at the top of the page, but this doesn't really look good, and seems illogical, as it disconnects the error text from the form itself.

My Question is this:

Is there any way to redirect it to "www.mysite.com#newsletter-form" upon generation of an error, so the viewing area automatically jumps back down to the form?

Thanks in advance!

Michael Griffin

Michael Griffin 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, set the action attribute on the form tag.

Oh ok! I didn't know if Perch would still get the data if I put a URL in the action. Thanks!