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

MultiValueField in silverstripe template


Go to End


2 Posts   2247 Views

Avatar
WebSpilka

Community Member, 89 Posts

24 December 2012 at 6:45am

Edited: 24/12/2012 6:45am

I use https://github.com/nyeholt/silverstripe-multivaluefield for my product $size values.
How to display these values ​​in a template?

public static $db = array(
		'Size'  => 'MultiValueField'
}
$sourceSize = array( 
							"12м." => "12м. (74-80см)",
							"18м." => "18м. (80-86см)",
							"2г."  => "2    (86-98см)"
				);
		
		$fields->addFieldToTab('Root.Main', new MultiValueCheckboxField('Size', 'Размер',$source = $sourceSize));

$SizeValue show to me a:4:{s:5:"12м.";s:5:"12м.";s:5:"18м.";s:5:"18м.";s:4:"2г.";s:4:"2г.";s:4:"4г.";s:4:"4г.";}
how to navigate through an array $Size?

<% loop Size %>$Value
<% end_loop %>

- does not show the values of ​​array

Avatar
MichalKleiner

Community Member, 4 Posts

9 December 2015 at 8:48pm