Answers.Body: <p>You can use <a href="https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_form_alter/7.x" rel="nofollow noreferrer">hook_form_alter</a> and in hook check if URL parameter for checksum is present then you can remove specific webform form elements like this:</p>
  
  <p>$form['submitted']['element_form_key']['#access'] = FALSE;</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-12T20:24:18.687Z
Answers.LastActivityDate: 2018-06-12T20:24:18.687Z
Answers.UserDisplayName: Hassan Farooq
Answers.Body: <p>I think this is possible with the below adjustments on the webform.</p>
  
  <ul>
  <li><p>Add a disabled textfield on your webform and set its default value to a token or checksum value from the URL.</p></li>
  <li><p>Now, add the condition on this element to hide email when it's value is not blank.</p></li>
  </ul>
  
  <p>Update after Karing's comment - If you need to hide the field from the webform, maybe use a little css like <code>display:none</code> for the same.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-11T13:32:50.890Z
Answers.Text: Yes that should work! Alternatively you could also try to just check off / select the checksum field in the CiviCRM Config section;
Answers.UserDisplayName: KarinG - Semper IT
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-11T13:38:11.827Z
Answers.Text: And you can always add other values to the webform link like ?myvar=1&cs=xxxx
Answers.UserDisplayName: RayWright
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-11T19:33:56.827Z
Answers.Text: Hello very helpful people! Thank you! I fear I need a little more! Jitendra - I can create a private civicrm field is that what you mean when you say hidden? When I created a private civicrm checksum field I couldn't get the conditional thing to work (I only had the option of is shown/is not shown and as the field was private it seemd to think it was always not shown). I wonder if you could elaborate a little more?
Answers.UserDisplayName: Caroline B
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-11T19:38:30.500Z
Answers.Text: Karin G - by this do you mean under the civicrm webfom tab select checksum - I did that and marked it private but as above couldn't get the conditional to recognise when an individual had one and when they didn't
Answers.UserDisplayName: Caroline B
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-11T19:38:51.077Z
Answers.Text: RayWright - how do I do that - that sounds very useful! Thank you!
Answers.UserDisplayName: Caroline B
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-13T02:33:03.577Z
Answers.Text: Yes you can not make the field private or you can’t use conditionals on it if you want to hide it - use some css display:none
Answers.UserDisplayName: KarinG - Semper IT
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-13T03:05:24.510Z
Answers.Text: Agree with the above comment. Have also updated the answer with the above suggestion.
Answers.UserDisplayName: jitendra - fuzion
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-13T03:50:38.290Z
Answers.Text: Can't you do a conditional off of the "Existing Contact" field? If I'm reading the question right then that field is already present but hidden on the form.
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-14T14:53:39.530Z
Answers.Text: @CarolineB the checksum in your URL is a query string, i.e. www.mysite?cid1={contact.contact_id}&{contact.checksum} you can add and variable you'd like (myvar=1234) and then throw that in a default value for a field [current-page:query:myvar]. I'm not sure you'd need it in this case but it's additional data you can use in the webform.
Answers.UserDisplayName: RayWright
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-11T09:46:11.480Z
Answers.LastActivityDate: 2018-06-13T03:05:02.000Z
Answers.LastEditDate: 2018-06-13T03:05:02.000Z
Answers.UserDisplayName: jitendra - fuzion
Body: <p>I use drupal 7 and latest civicrm. </p>
  
  <p>I direct people to my form using the checksum. I would like to not display email field and GDPR opt in field if they arrive at the form via checksum. If they arrive at the form without checksum I would like email/opt in to be visible.</p>
  
  <p>I know how to use conditionals within the form (eg if email address is present then display field X) but I can’t work out how to do it from the initial check sum - I feel it ought to be possible. Can anyone help?!</p>
  
  <p>Thanks!</p>
  
Tags: <drupal><webform-civicrm><checksum>
Title: Webform conditional from Civicrm checksum
ThreadText: # Webform conditional from Civicrm checksum
  
  (Asked by: username_0 on 2018-06-09)
  
  I use drupal 7 and latest civicrm.
  
  I direct people to my form using the checksum. I would like to not display email field and GDPR opt in field if they arrive at the form via checksum. If they arrive at the form without checksum I would like email/opt in to be visible.
  
  I know how to use conditionals within the form (eg if email address is present then display field X) but I can’t work out how to do it from the initial check sum - I feel it ought to be possible. Can anyone help?!
  
  Thanks!
  
  **Tags:** drupal, webform-civicrm, checksum
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2018-06-11. Score: 5 | Accepted answer
  
  I think this is possible with the below adjustments on the webform.
  
  * Add a disabled textfield on your webform and set its default value to a token or checksum value from the URL.
  * Now, add the condition on this element to hide email when it's value is not blank.
  
  Update after username_3's comment - If you need to hide the field from the webform, maybe use a little css like `display:none` for the same.
  
  > **Comments:**
  > **username_3**: Yes that should work! Alternatively you could also try to just check off / select the checksum field in the CiviCRM Config section;  
  > **username_4**: And you can always add other values to the webform link like ?myvar=1&cs=xxxx  
  > **username_0**: Hello very helpful people! Thank you! I fear I need a little more! username_2 - I can create a private civicrm field is that what you mean when you say hidden? When I created a private civicrm checksum field I couldn't get the conditional thing to work (I only had the option of is shown/is not shown and as the field was private it seemd to think it was always not shown). I wonder if you could elaborate a little more?  
  > **username_0**: Karin G - by this do you mean under the civicrm webfom tab select checksum - I did that and marked it private but as above couldn't get the conditional to recognise when an individual had one and when they didn't  
  > **username_0**: username_4 - how do I do that - that sounds very useful! Thank you!  
  > **username_3**: Yes you can not make the field private or you can’t use conditionals on it if you want to hide it - use some css display:none  
  > **username_2**: Agree with the above comment. Have also updated the answer with the above suggestion.  
  > **username_5**: Can't you do a conditional off of the "Existing Contact" field? If I'm reading the question right then that field is already present but hidden on the form.  
  > **username_4**: @username_0 the checksum in your URL is a query string, i.e. www.mysite?cid1={contact.contact_id}&{contact.checksum} you can add and variable you'd like (myvar=1234) and then throw that in a default value for a field [current-page:query:myvar]. I'm not sure you'd need it in this case but it's additional data you can use in the webform.  
  
  ---
  
  ### Answer by username_1 on 2018-06-12. Score: 0
  
  You can use [hook\_form\_alter](https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_form_alter/7.x) and in hook check if URL parameter for checksum is present then you can remove specific webform form elements like this:
  
  $form['submitted']['element\_form\_key']['#access'] = FALSE;
  
  
  ---
  
  