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.

Form Questions /

Custom Field question


Reply


808 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)
            );
}