How to use hook_webform_submission_presave In webform 7.x-4.10 I created a module like this:

function webform_presave_webform_submission_presave($node, &amp;$submission) {
  if ($webform-&gt;nid == 28) {
    $component_id = 1;
    $submission-&gt;data[$component_id]['value'][0] = 'Yes';
  }
}


My webform with nid 28 has only one field, a texfield with a default value to "No".

When the webform is submitted, the value of the field is not change...

What am I doing wrong?
Notice the value on which you check in the if.

the correct code is:

function webform_presave_webform_submission_presave($node, &amp;$submission) {
  if ($submission-&gt;nid == 28) {
    $component_id = 1;
    $submission-&gt;data[$component_id][0] = 'Yes';
  }
}