I have a webform with a hidden field having a default value of No. How do I change this value to Yes after a webform has been submitted using Rule? I'm using Drupal 7.x. Thank you.


You should make a custom module, rather than using Rules.

Your module will implement the hook_webform_submission_presave, as shown also in webform.api.php inside webform directory.

Your function should look like this (well, this could be your entire .module file):

function mymodule_webform_submission_presave($node, &$submission) {
  $component_id = 3; //that's your hidden field
  $submission->data[$component_id]['value'][0] = 'Yes';

Making a custom module is very easy, take a look here.

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.