6

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!

5

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 Karing's comment - If you need to hide the field from the webform, maybe use a little css like display:none for the same.

  • 1
    And you can always add other values to the webform link like ?myvar=1&cs=xxxx – RayWright Jun 11 '18 at 13:38
  • 1
    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? – Caroline B Jun 11 '18 at 19:33
  • 1
    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 – Caroline B Jun 11 '18 at 19:38
  • 1
    RayWright - how do I do that - that sounds very useful! Thank you! – Caroline B Jun 11 '18 at 19:38
  • 1
    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 – KarinG - Semper IT Jun 13 '18 at 2:33
0

You can use hook_form_alter 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;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.