Jump to:

10993 Posts in 2727 Topics by 1818 members

All other Modules

SilverStripe Forums » All other Modules » Need help with User Forms 0.3.0 module

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 809 Views
  • prawnstar
    Avatar
    Community Member
    116 Posts

    Need help with User Forms 0.3.0 module Link to this post

    I want to give my CMS admins the ability to create a custom form on a few page templates. The pages are not "form pages" per se, but they do allow a form to be included on them. So I have set up a many-many relationship between the extended form class and the pages that I want the form to appear on. A user creates a form in the CMS and then via the ManyManyComplexTableField can assign the form to a template with the many-many relationship.

    My problem is that everything seems to be working fine except when the template prints the form, it literally prints "$RightColumnForm" (the name of my extended class) instead of the actual form.

    I extended /userforms/code/UserdefinedForm.php class and changed the default content template to my new content template:

    /mysite/code/RightColumnForm.php

    class RightColumnForm extends UserDefinedForm {
       // ...
       static $defaults = array (
          'ShowInMenus' => false
          ,'ShowInSearch' => false
          ,'Content' => '$RightColumnForm'
       );
       // ...
    }

    Created my form template:
    /themes/mytheme_userforms/templates/Includes/RightColumnForm.ss

    <div>
       $Content
    </div>

    Included that template in my page:
    /themes/mytheme/templates/Includes/mypage.ss

    <% include RightColumnForm %>

    Screenshot of the problem attached.

    Thanks,
    Chris.b

  • prawnstar
    Avatar
    Community Member
    116 Posts

    Re: Need help with User Forms 0.3.0 module Link to this post

    To clarify some things...

    SS 2.4.0

    The many-many relationship between the page class and the extended form class is working. The conditional statement in the template.ss file is showing the title of the correct form that is associated with that page. It's the form itself that's not showing up.

    If I remove the $RightColumnForm from the CMS, still nothing shows up.

    If I hit the form url directly, instead of the url of the page it is included on, the form shows correctly.

    Thanks for any assistance.
    C.b

  • prawnstar
    Avatar
    Community Member
    116 Posts

    Re: Need help with User Forms 0.3.0 module Link to this post

    Sorry to continue this one-man discussion, but can anyone confirm that this should or shouldn't work? I feel like I'm just banging my head against this wall.

    Since the $MenuTitle.XML of the form displays, I know the many-many relationship between the forms and the pages are working; but not the actual form.

    Can userforms not be extended or do they just not play nice in a many-many relationship?

    This is my template.ss code:

    <% if RightColumnForms %>
       <% control RightColumnForms %>
          <h3 class="accHeader $LinkingMode">
             $MenuTitle.XML
          </h3>
          <div class="accCell">
             $Content
          </div>
       <% end_control %>
    <% end_if %>

    C.b

    809 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.