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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

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

FAQ module


Go to End


13 Posts   7154 Views

Avatar
Ssendol

Community Member, 1 Post

1 September 2009 at 9:01pm

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

Community Member, 1 Post

6 September 2009 at 10:24pm

I faced the same problem!!!

MultiSelectField module is installed.

Please help!

Avatar
OnebyOne

Community Member, 54 Posts

8 September 2009 at 3:57am

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

Community Member, 13 Posts

5 October 2009 at 9:33am

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

Community Member, 13 Posts

5 October 2009 at 10:56am

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

Community Member, 9 Posts

7 October 2009 at 11:42pm

Edited: 07/10/2009 11:42pm

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

Community Member, 54 Posts

16 October 2009 at 2:00am

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

Community Member, 32 Posts

18 October 2009 at 6:03pm

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