Hi,

I've successfully set up a contact form in cakePHP, and when
validation rules in my model don't pass, the form is reloaded with all
my validation errors displayed properly. That battle was won :)

Now for the tricky part.

Can anyone think of a way to not only have the form page reload with
error messages, but jump to an anchor link at the top of the form if
errors are present? I'm sure I could use javascript for this, but as
it stands I can't count on users having javascript enabled. Currently
when the form reloads with error messages in place, users have to
scroll down from the top of the page, and I see this as a slight
problem.

Obviously CakePHP is smart enough to redirect to an appropriate URL
when validation fails, all I need to do is add #myAnchor to the end of
that URL somehow. Any ideas?

I've thought of adding a line to my beforeFilter that says something
like

1. if we're visiting the form page
2. and if some error flag variable is set
3. catch the URL somehow
4. Add the anchor to the end

But I'm not sure on the specifics of how I'd go about this, and as
this filter would run before the any page in the controller runs, I
have concerns about efficiency. Any ideas?

Thanks in advance for your input.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to