Body: <p>I need to set up a <strong>Webform CiviCRM in Drupal</strong> with a component that can have <strong>multiple values</strong> (checkbox).
  But I need to establish its value <strong>based on the value of another field</strong>.</p>
  <p>How can I set <strong>multiple values for the Checkbox component using conditionals</strong>?</p>
  <p>Also, as the value of this multiple Checkbox depends on the value of another field, I need to keep the former value, and add a new one without removing the previous one.</p>
  <p>I have included a screenshot of the conditionals.</p>
  <p><a href="https://i.sstatic.net/ozWVn.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ozWVn.png" alt="enter image description here" /></a></p>
  <p>With these conditions, they can only have a unique value and if the user selects more than one option on the field &quot;<em>Support you are looking for</em>&quot; the previous value of &quot;<em>Group(s)</em>&quot; is removed,
  so the last condition which is met is the one that establishes the value of &quot;<em>Group(s)</em>&quot;.</p>
  <p>Any help would very much appreciated.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-13T12:19:14.240Z
Comments.Text: If you're hiding the triggered fields from the user, `_webform_submission_presave($node, &$submission) {` should help in modifying the values before the submission is saved. If not - i think its better to implement this in custom js.
Comments.UserDisplayName: jitendra - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-13T19:09:54.477Z
Comments.Text: can you tag this Q with D7 or D8 since the approach differs
Comments.UserDisplayName: petednz - fuzion
Tags: <webform-civicrm><drupal-7>
Title: How to set multiple values for a Checkbox component in webform with conditionals and keeping the old value
ThreadText: # How to set multiple values for a Checkbox component in webform with conditionals and keeping the old value
  
  (Asked by: username_0 on 2020-11-13)
  
  I need to set up a **Webform CiviCRM in Drupal** with a component that can have **multiple values** (checkbox).
  But I need to establish its value **based on the value of another field**.
  
  How can I set **multiple values for the Checkbox component using conditionals**?
  
  Also, as the value of this multiple Checkbox depends on the value of another field, I need to keep the former value, and add a new one without removing the previous one.
  
  I have included a screenshot of the conditionals.
  
  [![enter image description here](https://i.sstatic.net/ozWVn.png)](https://i.sstatic.net/ozWVn.png)
  
  With these conditions, they can only have a unique value and if the user selects more than one option on the field "*Support you are looking for*" the previous value of "*Group(s)*" is removed,
  so the last condition which is met is the one that establishes the value of "*Group(s)*".
  
  Any help would very much appreciated.
  
  **Tags:** webform-civicrm, drupal-7
  
  > **Comments:**
  > **username_1**: If you're hiding the triggered fields from the user, `_webform_submission_presave($node, &$submission) {` should help in modifying the values before the submission is saved. If not - i think its better to implement this in custom js.  
  > **username_2**: can you tag this Q with D7 or D8 since the approach differs  
  
  ---
  
  ## 0 answers
  
  