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.

Customising the CMS /

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

CheckboxsetField -> Value


Go to End


1178 Views

Avatar
StefanDpunkt

Community Member, 14 Posts

17 October 2013 at 9:07pm

Edited: 17/10/2013 9:27pm

Hi,

I have a question about " CheckboxsetField " .
I put a CheckboxsetField as follows to:

$ fields -> addFieldToTab ( ​​" Root.Material ", new CheckboxsetField (
  " Material ", " material " ,
  array (
    "Men " => " people " ,
    "Women " => "Women "
    " Functional" => " functional fiber "
    " Cotton " => " cotton " ,
    " QuickDryFinish " => " Quick Dry Finish"
    " IndoorDryStretch " => "Indoor Dry Stretch "
    " IndoorDryIntelligent " => "Indoor Dry Intelligent "
    " IndoorDry " => "Indoor Dry "
    " CoolMax " => " Cool Max "
    )
  )
);

in the template and get the following output:

<input type="checkbox" id="Men" name="series[]" value="Men" />
<input type="checkbox" id="Women" name="series[]" value="Women" />
<input type="checkbox" id="Funktionsfaser" name="series[]" value="Funktionsfaser" />
<input type="checkbox" id="Baumwolle" name="series[]" value="Baumwolle" />
<input type="checkbox" id="Quick Dry Finish" name="series[]" value="Quick Dry Finish" />
<input type="checkbox" id="Indoor Dry Stretch" name="series[]" value="Indoor Dry Stretch" />
<input type="checkbox" id="Indoor Dry Intelligent" name="series[]" value="Indoor Dry Intelligent" />
<input type="checkbox" id="Indoor Dry" name="series[]" value="Indoor Dry" />
<input type="checkbox" id="Cool Max" name="series[]" value="Cool Max" />
[/code ]

But I want to have a value in the 1 , or string !

How do I solve this ?