30 October 2009 at 3:56am
I'm trying to create an "email this link to a friend" form. Right now the the form is rendered into a hidden div and revealed in a model dialog box. Thats fine an dandy, but I'd like to get the form to render either on its own page or the page in question when an "email this page" link is clicked much like the login form works.
Right now the best solution I can think of is to Create a new Page.ss with the form where I want it to render and create a RenderWithTemplate function in my Page class and just reload the page with the new template. But this seems a little convoluted.
Is there a more elegant solution? Perhaps using ModelAsController (I'm having trouble finding an adequate description od how this workd in the documentation)
30 October 2009 at 7:06am
Either way you'll probably want to break out your Form into a separate control in your Page_Controller (The forms tutorial covers this). A slick experience would be to use a modal to present the form inline.
Oh, and I just happened to do a writeup on that!
I've gotten a lot of mileage out of using forms inside of modals, very handy.
Also, I've also had some troubles figuring out exactly how to make ModelAsController work. It hasn't yet been beaten into submission.