Answers.Body: <p>To answer my own question, this is what I found.
  The answer is to use <code>get...</code> methods.</p>
  
  <pre><code>craft()-&gt;on(
      "freeform_submissions.onBeforeSave",
      function (Event $event) {
          $submission = $event-&gt;params["model"];
          $field_item = $submission-&gt;fieldMetadata['field_handle'];
          $field_value = $field_item-&gt;getValue();
  
      }
  );
  </code></pre>
  
  <p>The <code>$field_item-&gt;getValue()</code> can be <code>$field_item-&gt;getId()</code> or <code>$field_item-&gt;getHandle()</code> and so on.</p>
  
  <p>The properties listed here: <a href="https://solspace.com/craft/freeform/docs/field/" rel="nofollow noreferrer">https://solspace.com/craft/freeform/docs/field/</a> can be used by turning the property into a method and prepending <code>get</code>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-08T19:07:59.243Z
Answers.LastActivityDate: 2017-06-08T19:07:59.243Z
Answers.UserDisplayName: Sheldon
Body: <p>I am trying to get the value of a field from a freeform event.  Specifically I'm trying to see if a particular checkbox is in a form submission.</p>
  
  <pre><code>craft()-&gt;on(
      "freeform_submissions.onBeforeSave",
      function (Event $event) {
          $submission = $event-&gt;params["model"];
          $field = $submission['fieldMetadata']['checkbox_handle'];
  </code></pre>
  
  <p>This works to this point.  I see if I do <code>Craft:dd($field);</code> I have a checkboxField object. But from here on I can't get any info about that field.</p>
  
  <pre><code>        $id = $field-&gt;id; // or:
          $handle = $field-&gt;handle; // and any other properties
  </code></pre>
  
  <p>This throws: <code>Fatal error: Cannot access protected property Solspace\Freeform\Library\Composer\Components\Fields\CheckboxField::$id</code>.</p>
  
  <p>If I try:</p>
  
  <pre><code>        $id = $field['id'];
  </code></pre>
  
  <p>I get: <code>Fatal error: Cannot use object of type Solspace\Freeform\Library\Composer\Components\Fields\CheckboxField as array</code></p>
  
  <p>The properties and methods are listed at: <a href="https://solspace.com/craft/freeform/docs/field/" rel="nofollow noreferrer">https://solspace.com/craft/freeform/docs/field/</a>, but I can't access the properties.  I can call the <code>render()</code> method which works and that outputs html.  I'm sure its something obvious, but I'm missing it.</p>
  
Tags: <plugin-development><plugin-freeform><solspace><freeform>
Title: How to access a freeform field object's properties from an event
ThreadText: # How to access a freeform field object's properties from an event
  
  (Asked by: username_0 on 2017-05-31)
  
  I am trying to get the value of a field from a freeform event. Specifically I'm trying to see if a particular checkbox is in a form submission.
  
  ```
  craft()->on(
      "freeform_submissions.onBeforeSave",
      function (Event $event) {
          $submission = $event->params["model"];
          $field = $submission['fieldMetadata']['checkbox_handle'];
  
  ```
  
  This works to this point. I see if I do `Craft:dd($field);` I have a checkboxField object. But from here on I can't get any info about that field.
  
  ```
          $id = $field->id; // or:
          $handle = $field->handle; // and any other properties
  
  ```
  
  This throws: `Fatal error: Cannot access protected property Solspace\Freeform\Library\Composer\Components\Fields\CheckboxField::$id`.
  
  If I try:
  
  ```
          $id = $field['id'];
  
  ```
  
  I get: `Fatal error: Cannot use object of type Solspace\Freeform\Library\Composer\Components\Fields\CheckboxField as array`
  
  The properties and methods are listed at: <https://solspace.com/craft/freeform/docs/field/>, but I can't access the properties. I can call the `render()` method which works and that outputs html. I'm sure its something obvious, but I'm missing it.
  
  **Tags:** plugin-development, plugin-freeform, solspace, freeform
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-06-08. Score: 2 | Accepted answer
  
  To answer my own question, this is what I found.
  The answer is to use `get...` methods.
  
  ```
  craft()->on(
      "freeform_submissions.onBeforeSave",
      function (Event $event) {
          $submission = $event->params["model"];
          $field_item = $submission->fieldMetadata['field_handle'];
          $field_value = $field_item->getValue();
  
      }
  );
  
  ```
  
  The `$field_item->getValue()` can be `$field_item->getId()` or `$field_item->getHandle()` and so on.
  
  The properties listed here: <https://solspace.com/craft/freeform/docs/field/> can be used by turning the property into a method and prepending `get`.
  
  
  ---
  
  