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.

Form Questions /

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

Custom Field question


Go to End


1334 Views

Avatar
fyodore

Community Member, 2 Posts

21 April 2010 at 3:38am

I am trying to figure out what I should use to get the text that was added to a editablecheckboxoption from a submitted for to put it in the email. I can get the integer ID value, but dont know if there is a way in silverstripe to have it use that string to get me the values.

If you look below, $this->{$stringID} gives me the integer ID's seperated by commas of the editablecheckboxoption. I am missing something and not sure what.

if ( $field instanceof EditableCheckboxGroupField)
{

//get the unique id from a string stored in the field
$stringID = $field->Name;

$values = array();
$values['Key'] = $field->Title;

//load the value from this object using the unique string id from before
$values['Value'] = $this->{$stringID};
$set->push(
new ArrayData($values)
);
}