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

UserForm in FancyBox - Completion Redirect


Go to End


3 Posts   2094 Views

Avatar
juneallison

Community Member, 110 Posts

27 September 2013 at 10:04am

Hi,

So I have a form created with the UserForm Module that opens in a light box. That part is working fine. After a user fills out the form and hits submit, they get redirected to a different page. I know this is triggered by:
return $this->redirect($this->Link() . 'finished' . $referrer); (Ln 938 of UserDefinedForm.php)

On that "finished" page they see the correct completion message. What I really want to happen is for that completion message to appear inside of the lightbox. Ideally the form would disappear and they would see the completion message.

Any suggestions on how to go about this would be great.

Thank you!

June

Avatar
Willr

Forum Moderator, 5523 Posts

28 September 2013 at 5:07pm

You'll need to submit the form in the popup through javascript and load the resulting page. A plugin like http://malsup.com/jquery/form/ gives a clean way to submit the form and handle the result.

Avatar
juneallison

Community Member, 110 Posts

1 October 2013 at 2:34am

Willr - Excellent! Thank you for your reply. I'll give this a try. Since my original post, I did discover that if I set fancybox's content type to iframe I get the entire sequence (form > success message) within the popover, but I would prefer to make the ajax version work.

Thanks for your help!