Answers.Body: <p>OK - I found the answer with a bit of a hack - you need to include the parameter in the URL whether you are going to use it or not.</p>
  <p>So in my View I used to create and display links to this form with parameters depending on the context.  Now, I just include &amp;sessionID= and it works fine e.g. even though I know a particular link does not need this parameter, I just supply it anyway:</p>
  <p>/myform?civicaseID=12345&amp;cid1=9876&amp;cid2=8765&amp;cid3=7654&amp;sessionID=</p>
  <p>This seems to work fine and I've not seen any side effects for it.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-06T09:55:45.347Z
Answers.LastActivityDate: 2023-07-06T09:55:45.347Z
Answers.UserDisplayName: ChumKui
Body: <p>I am converting a Drupal 7 webform that uses two tokens in a text field's default data field to display data passed in via the URL e.g.</p>
  <pre><code>/myform?civicaseID=12345&amp;sessionID=6789&amp;cid1=9876&amp;cid2=8765&amp;cid3=7654
  </code></pre>
  <p>The tokens in the text fields default value are:</p>
  <pre><code>[current-page:query:civicaseID] [current-page:query:sessionID]
  </code></pre>
  <p>The link, created from a Drupal View, supplies all the data. Some links include <code>...&amp;sessionID={{ xyz }}</code> and some do not depending on the context.  The same form is reused for all instances, it is just that for some, we do not need to display this additional session ID data.</p>
  <p>For all cases it displays the CiviCRM case ID as it is always present, the second token would not print if there was no data in the URL, now, it just prints the token itself if there is no data e.g. for this URL:</p>
  <pre><code>/myform?civicaseID=12345&amp;cid1=9876&amp;cid2=8765&amp;cid3=7654
  </code></pre>
  <p>It populates that text field with:</p>
  <pre><code>12345 [current-page:query:sessionID]
  </code></pre>
  <p>Is there a setting/technique to hide this behaviour somewhere, or is it a bug?</p>
  
Tags: <webform-civicrm><tokens>
Title: Is there a setting for Drupal Webform displaying raw token when they have no data to display
ThreadText: # Is there a setting for Drupal Webform displaying raw token when they have no data to display
  
  (Asked by: username_0 on 2023-07-06)
  
  I am converting a Drupal 7 webform that uses two tokens in a text field's default data field to display data passed in via the URL e.g.
  
  ```
  /myform?civicaseID=12345&sessionID=6789&cid1=9876&cid2=8765&cid3=7654
  
  ```
  
  The tokens in the text fields default value are:
  
  ```
  [current-page:query:civicaseID] [current-page:query:sessionID]
  
  ```
  
  The link, created from a Drupal View, supplies all the data. Some links include `...&sessionID={{ xyz }}` and some do not depending on the context. The same form is reused for all instances, it is just that for some, we do not need to display this additional session ID data.
  
  For all cases it displays the CiviCRM case ID as it is always present, the second token would not print if there was no data in the URL, now, it just prints the token itself if there is no data e.g. for this URL:
  
  ```
  /myform?civicaseID=12345&cid1=9876&cid2=8765&cid3=7654
  
  ```
  
  It populates that text field with:
  
  ```
  12345 [current-page:query:sessionID]
  
  ```
  
  Is there a setting/technique to hide this behaviour somewhere, or is it a bug?
  
  **Tags:** webform-civicrm, tokens
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2023-07-06. Score: 1 | Accepted answer
  
  OK - I found the answer with a bit of a hack - you need to include the parameter in the URL whether you are going to use it or not.
  
  So in my View I used to create and display links to this form with parameters depending on the context. Now, I just include &sessionID= and it works fine e.g. even though I know a particular link does not need this parameter, I just supply it anyway:
  
  /myform?civicaseID=12345&cid1=9876&cid2=8765&cid3=7654&sessionID=
  
  This seems to work fine and I've not seen any side effects for it.
  
  
  ---
  
  