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.

Template Questions /

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

Javascript popup window with user-editable content


Go to End


20 Posts   19996 Views

Avatar
sajok

Community Member, 82 Posts

16 February 2010 at 4:22am

thanks mat,

I found a jquery plugin " PrintElement" which works now after tweaking to preview the selected div element in a popup with only print stylesheet. The user then proceeds to printing it. I'm not sure however if such functionality can be done without this extra jquery plugin.. is that possible?

thanks

Avatar
MateuszU

Community Member, 89 Posts

16 February 2010 at 8:47am

How big is the plugin? I think if there is a plugin, stick to it, it's going to save you heaps of development time. Everybody uses JS and websites are also pretty quick nowadays, with the caching, proxies and whatnots. Just have a look at yahoo.com, it serves 500kB of content on the homepage ;)

But it should be doable via silverstripe, you could define an action on the Page_controller that would render the page using another template, although if you wanted to do it in apopup, you would need to use an iframe, otherwise the stylesheets will leak from the parent page and all your work will go to waste.

Avatar
ewilliams

Community Member, 12 Posts

16 February 2010 at 9:37am

PS: after I figured out the whole pop-up window thing, I learned my client didn't want the title bar, etc, of an actual pop-up, so I decided to use a hidden/visible javascript to display a DIV (styled with CSS, using absolute positioning) that was contained in the layout/homepage.ss code. But I used many of the same methods as for a pop-up window.

Avatar
MateuszU

Community Member, 89 Posts

16 February 2010 at 9:41am

Way to go, popups are evil and browsers try to block them anyway. With JS popup we wouldn't get into the <body> problem in the first place, although I admin it's a CMS bug :)

Go to Top