Login | Forgot password | Register

X

What is OpenID?

OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account.

With OpenID, your ID becomes a URL (e.g. http://username.myopenid.com/). You can get a free OpenID for example from myopenid.com.

For more information visit the official OpenID site.

Jump to:

762 Posts in 243 Topics by 250 members

Form Questions

SilverStripe Forums » Form Questions » Show a form in the sidebar

Page: 1
Go to End
Author Topic: Show a form in the sidebar 294 Views
  • michaek
    avatar
    Community Member
    7 posts

    Show a form in the sidebar Link to this post

    Seems like this shouldn't be tricky, but I haven't worked it out yet. What I'd like to do is display the form for a page (in this case, a UserDefinedForm) in the sidebar. Let's say it's a contact form we'd like to display on every page.

    We'd think that this might work:

    <% control Page(contact) %>
    $Content
    $Form
    <% end_control %>

    It doesn't - it only displays the Content of the contact page. The reason for this is that the model object is returned from Page(), but Form is a method of the controller. That makes sense, really. It's sort of weird to be getting a display from the model.

    However, that's what we're expected to do here, for some reason, because that's what the Page controller method returns. Would it make more sense if it returned a controller object of some kind? Or should the Form display be passed through the model as well (seems messy to me!).

    This is a problem others have had:
    http://silverstripe.org/archive/show/235767 - Newsletter Signup in Sidebar
    http://silverstripe.org/archive/show/89383 - How to add a "Subscribe Form" into the another page

    I have two questions (because my hunch is the answers are different):
    1. What's the way to get this to work?
    2. What's the cleanest architecture to allow this behavior?

    Thanks!

    294 Views
Page: 1
Go to Top

Currently Online: BigChris, Euphemismus

Welcome to our latest member: GreenWork

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

Comments on this website? Please give feedback.