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.

All other Modules /

Discuss all other Modules here.

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

Need help with User Forms 0.3.0 module


Reply


3 Posts   821 Views

Avatar
prawnstar

Community Member, 116 Posts

6 October 2010 at 8:40am

Edited: 06/10/2010 9:01am

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

Avatar
prawnstar

Community Member, 116 Posts

6 October 2010 at 11:51am

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

Avatar
prawnstar

Community Member, 116 Posts

7 October 2010 at 12:37pm

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