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.

Form Questions /

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

Displaying User Defined Forms in a pop up window?


Go to End


6 Posts   3857 Views

Avatar
Valorinbattle

Community Member, 95 Posts

1 October 2010 at 6:11pm

I have a client that wants their Contact Us form to be displayed in a popup box over the page the visitor was just on, instead of taking visitors to a separate Contact page.

Is there an easy way to do this?

Thanks!

Avatar
swaiba

Forum Moderator, 1899 Posts

1 October 2010 at 10:54pm

Yes, should be no problem, just take your favourite pop-up div box page thingy (e.g. SS uses greybox within ModelAdmin for has_many relations or facebox (http://chriswanstrath.com/facebox/) is quite nice as it looks like facebook pop-up. Then just give it the URL of a page with that userform in (so the user form will not be a shown in the menu or search).

example with grey box...

GB_show('Cancel Day','urlsegmentofpage/');

example with facebox...

jQuery.facebox(function() {
	jQuery.get('urlsegmentofpage/', function(data) { jQuery.facebox(data) })
 })

Barry

Avatar
Valorinbattle

Community Member, 95 Posts

2 October 2010 at 7:51am

Barry, thanks for the reply. Where do I enter this code?

Avatar
swaiba

Forum Moderator, 1899 Posts

5 October 2010 at 9:30pm

That is javascript code so you have several options... I'd advise reading... http://doc.silverstripe.org/javascript and http://doc.silverstripe.org/requirements

Avatar
Valorinbattle

Community Member, 95 Posts

19 October 2010 at 11:36am

Anybody interested in helping me with this on a payment basis? Swaiba?

Avatar
swaiba

Forum Moderator, 1899 Posts

19 October 2010 at 11:51pm

If you, or anyone else wants to send me stuff to do you are most welcome, I'll make sure my email shows on my profile page.

For this I am sure all the docs are there to get this working...

1)Create a standard page with your User Defined Form
2)Create a second page type, with a .php and .ss (for help on this see the tutorials... http://doc.silverstripe.org/tutorials)
3)In that page init function or the template require the javascript for the popup box
4)in the template add the javascript I gave in my earlier posts with the URLSegment from (1)
(Note (4) should really be to add a new javascript file or add custom so that the javascript can be combined)

Break the task down... get the popup working in test.html on your local machine with nothing special, then get it to load a page, then make your page in ss, then get your page to load the popup, finally get the popup to show the required page with the form on it