1779 Posts in 582 Topics by 556 members
| Go to End | ||
| Author | Topic: | 4017 Views |
-
Re: How do I render a form or object into a javascript popup?

29 August 2009 at 10:44pm
Ah,
I'll check it out, thanks.I've ended up just putting some javascript in the template to launch a GreyBox. A bit untidy but it does the job. The template has conditional rendering to do the 'thank-you' after submission. Would still like to try figuring out how to get Ajax working through SS forms (Which I imagine I would need to launch a javascript popup).
-
Re: How do I render a form or object into a javascript popup?

8 September 2009 at 9:33pm
OK,
So for anyone who is interested, hello? hellllooooooooo (echo)
I've managed to do everything I needed without any Ajax in the end. I used GreyBox (didn't like the default css themes on colorbox and the GB with SS looked fine) and jQuery.1. Render a form into a javascript popup with a thankyou message on submission.
An HTML <li> element on the main page has a javascript function 'launchSignup()' as it's 'onclick' property.
The javascript function calls GreyBox with the location of a virtual subpage of the main page
The virtual subpage function just re-renders the object with a new template file containing the form variable and different content
the form action function does its thing and re-renders the object with a thankyou template displaying more content from the CMS2. Render HTML returned from an external service into a javascript popup
An accountID input field on the main page hold the account ID
An action button just below it has a javascript function call as its onclick property
the javascript function calls GreyBox with the URL mainpage/balance/accountID
the balance function calls the external service with the accountID and receives an HTML response which is stored in a local variable
the balance funcrion returns renderWith('BalancePage.ss') which has a reference to the local variable to render the result.Easy once you know how :o)
All done from a single slab of PHP and a light sprinkling of javascript. Isn't SS wonderful? -
Re: How do I render a form or object into a javascript popup?

19 December 2009 at 7:34am
Thanks Zalzadore. this is exactly what I am trying to do but I can't get it to work .
I have tried something as simple as :
<a href="http://www.lisianne.com/SilverStripe/myform" title="myform" rel="gb_page_center[500, 500]">Launch myform</a>
in my templateand I get a Page Not found error in the popup window.
So I tried this :
<a href="http://www.google.com" title="Google" rel="gb_page_center[500, 500]">Launch Google.com</a>an I get the same error in the popup window also!! I think I am missing something obvious , even though the windows pops open properly .
I am hoping you might be wathcing this great post of yours !Thanks
| 4017 Views | ||
| Go to Top |


