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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Form Questions /

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

How to loop through a CheckboxsetField?


Go to End


3 Posts   898 Views

Avatar
_Vince

Community Member, 165 Posts

25 January 2012 at 10:55am

Edited: 25/01/2012 10:56am

I have a table of skills and a table of EmployeeSkills. to display this on a form, I use a CheckboxsetField and it works great.

But now, I am being asked to add a dropdown list of skill levels for each Employee Skill.

So what I want to do is have
a checkbox and a dropdown list next to it
a checkbox and a dropdown list next to it
a checkbox and a dropdown list next to it

and so on.

Is there any way to say something like

<% control MyCheckboxSetField %>
<div class="field checkbox">
<label class="left" for="{$FormName}_SkillName">Skill Name</label>
<div class="middleColumn">
$dataFieldByName(Current Iteration Of The Checkbox List)
</div>
</div>
<div class="field list">
<label class="left" for="{$FormName}_SkillName">Skill level</label>
.
.
.
</div>

<% end_control %>

Avatar
_Vince

Community Member, 165 Posts

28 January 2012 at 10:07am

Anybody? All I want is to be able to loop through the CheckboxsetField so I can lay them out in different ways.

Avatar
martimiz

Forum Moderator, 1391 Posts

1 February 2012 at 6:33am

As I read this, you want to create some sort of nested CheckBoxSetField where the 'inner' options are represented by dropdown fields. If that's what you mean, I don't think it can be done.

Can you give us an idea of the relations involved?