Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Mollom error message too far down the page - users don't see it


Go to End


5 Posts   1947 Views

Avatar
jodamo5

Community Member, 9 Posts

25 April 2010 at 4:22pm

Hi. The contact form I am using Mollom on is down the bottom of a page.

When someone enters an incorrect captcha entry, the page is reloaded back to the top of the page. So our users think the form has sent, because they don't see the error message (which they have to scroll down to see).

Is there a way I can set an anchor on the page so that mollom will always jump to that anchor?

I contacted the guys at Mollom and they said it would need to be referred to the Silverstripe team.

Avatar
Willr

Forum Moderator, 5523 Posts

25 April 2010 at 5:10pm

Yes this is SS issue rather than mollom. The redirection back down to the form on error is part of the core (The mollom validator simply returns pass or fail) so it doesn't handle any redirecting.

If you set $form->redirectToFormOnValidationError(true); it will redirect the user back down to the form. Using that line should work fine in your custom forms. If your using the UserForms module you can't set that property from the CMS so you might have to edit the module.

Avatar
jodamo5

Community Member, 9 Posts

25 April 2010 at 8:30pm

Hi Will. Thanks for the speedy reply. I am using UserForms, so it sounds like I'll have to edit the module.

So which file (and where in the file) do I insert this line?
$form->redirectToFormOnValidationError(true)

Thanks heaps.

Avatar
bennettpr

Community Member, 37 Posts

29 September 2010 at 11:01am

This should be:

$form->setRedirectToFormOnValidationError(true);

:)
Paul

Avatar
jodamo5

Community Member, 9 Posts

29 September 2010 at 4:33pm

Thanks for that correction Paul. Can you please tell me which file that line should be inserted in? And where in the file?

(I am using the "User Forms" module to run the forms if that makes any difference).

thanks!
Josh