Jump to:

2002 Posts in 1422 Topics by 616 members

Form Questions

SilverStripe Forums » Form Questions » Displaying User Defined Forms in a pop up window?

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

Page: 1
Go to End
Author Topic: 2246 Views
  • Valorinbattle
    Avatar
    Community Member
    95 Posts

    Displaying User Defined Forms in a pop up window? Link to this post

    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!

  • swaiba
    Avatar
    Forum Moderator
    1785 Posts

    Re: Displaying User Defined Forms in a pop up window? Link to this post

    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

  • Valorinbattle
    Avatar
    Community Member
    95 Posts

    Re: Displaying User Defined Forms in a pop up window? Link to this post

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

  • swaiba
    Avatar
    Forum Moderator
    1785 Posts

    Re: Displaying User Defined Forms in a pop up window? Link to this post

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

  • Valorinbattle
    Avatar
    Community Member
    95 Posts

    Re: Displaying User Defined Forms in a pop up window? Link to this post

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

  • swaiba
    Avatar
    Forum Moderator
    1785 Posts

    Re: Displaying User Defined Forms in a pop up window? Link to this post

    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

    2246 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.