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

FAQ module


Go to End
Reply

13 Posts   4437 Views

Avatar
Ssendol

1 September 2009 at 9:01pm Community Member, 1 Post

I tried install FAQ module in SS 2.3.1.
I installed MultiSelectField v.0.2 and installed Faqs V0.5.
But I get error when I create 'Faq Page' in Admin. 'Faqs Holder' is OK.

Error as follow;

ERROR [Warning]: Invalid argument supplied for foreach()
IN POST /ss/admin/getitem?ID=23&ajax=1
Line 33 in /var/www/ss/multiselectfield/code/MultiSelectField.php

Source
======
24: 'class'=>$this->extraClass()
25: );
26: if ($this->disabled)
27: $attributes['disabled'] = 'disabled';
28:
29: // Build options
30: $content = '';
31: $source = $this->source;
32: $value = $this->getSelected();
* 33: foreach($source as $index => $item) {
34: $selected = (isset($value[$index])) ? 'selected' : '';
35: $content .= "<option $selected value=\"$index\">$item</option>";
36: }
37:
38: return $this->createTag('select', $attributes, $content);
39: }

<ul>MultiSelectField->Field()
call_user_func_array(Array,Array)
line 408 of ViewableData.php

ViewableData->XML_val(Field)
line 370 of FormField.php

FormField->FieldHolder()

call_user_func_array(Array,Array)
line 408 of ViewableData.php

How can I fix this problem ?
Thanks...
ViewableData->XML_val(FieldHolder,,1)
line 74 of .cache.var.www.ss.sapphire.templates.TabSetFieldHolder.ss

include(/tmp/silverstripe-cache-var-www-ss/.cache.var.www.ss.sapphire.templates.TabSetFieldHolder.ss)
line 354 of SSViewer.php

Avatar
Mehanik

6 September 2009 at 10:24pm Community Member, 1 Post

I faced the same problem!!!

MultiSelectField module is installed.

Please help!

Avatar
OnebyOne

8 September 2009 at 3:57am Community Member, 54 Posts

I installed latest stable faqs and multiselectfield modules from (Extensions/Module zone) and latest SS (2.3.3) and is working, at least i have no error,

I can create faqs pages, but the Faqs Holder is empty - shouldn't Faqs Holder show the faqs like a the blog module ?

THX

Avatar
rgo

5 October 2009 at 9:33am Community Member, 13 Posts

I cannot reproduce the error with Silverstripe v2.3.3. I'll check previous version. Regarding FaqsHolder question: It should show a list of children pages. Without sidebar and without a theme the page list stay at left of the holder page. I'll make a theme sample for faqs module.

Avatar
rgo

5 October 2009 at 10:56am Community Member, 13 Posts

I just try the Silverstripe v2.3.0 and faqs Module works. If the errors still occurs please let me know the installed modules. Tested on Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.2 with Suhosin-Patch

Avatar
pst

7 October 2009 at 11:42pm (Last edited: 7 October 2009 11:42pm), Community Member, 9 Posts

I can confirm the problem. It seems, that the syntax for the multiselectfield has changed. There is not changelog for the multiselectfield module, but the README states a change.

I have faqsmodule 0.5.0 and multiselectfield 0.2

Changing the addfieldtotab to the following seems to fix the problem.

// -- Related Faqs
$source = DataObject::get('FaqsPage');
$fields->addFieldToTab(
"Root.Content.Related",
new MultiSelectField(
      "FaqsRelated", // Relationship
      "Related Faqs", // Field name
      $source->toDropdownMap('ID','Title') // Source records (array)
   )
);

But the multiselectfield does not look like the screenshot here -> (http://silverstripe.org/multiselectfield-module/). It only has the left box and you can select and deselect RelatedFaqs using ctrl-key.

Avatar
OnebyOne

16 October 2009 at 2:00am Community Member, 54 Posts

yes, is working, first time i deleted by mistake the

return $fields;
   }


and the system crashed.

so, here is the complete code, Change in FaqsPage.php (under code in faqs module)
this

// -- Related Faqs
$fields->addFieldToTab("Root.Content.Related", new MultiSelectField(
"FaqsRelated", _t("FaqsPageEntry.RELATEDLABEL", 'Related'), "FaqsPage", "ID", "Title"));
return $fields;
   }

with this

// -- Related Faqs
$source = DataObject::get('FaqsPage');
$fields->addFieldToTab("Root.Content.Related",new MultiSelectField(
"FaqsRelated", "Related Faqs", $source->toDropdownMap('ID','Title') )
);
return $fields;
   }

Avatar
Chucky2k

18 October 2009 at 6:03pm Community Member, 32 Posts

Hi,

I have this working now after the mod posted by OnebyOne, however, I have one small problem in that I can select one FAQPage for related FAQ and all saves fine. If I try to select more than one, after the save there none remain.

Cheers
David

Go to Top