0

I created a webform for which I need all the submitted fields with values on the confirmation page after the user submitted the form. I am using WebForm 7.3.

The user when confirms the information, can make any final change before submitting it (updating the existing one, I guess).

This is what I used and placed it in the template.php but sadly it doesn't work:-

function user_register_webform_submission_insert($node, $submission){
// Load information about form components
$comps = $node->webform['components'];
$fields = array();

//Extract the component info to get form_key=>cid to resolve relation
foreach($comps as $cid => $comp_info){
    $fields[$comp_info['form_key']] = $cid;
}

// Load the submitted data (field values)
$data = $submission->data;

//Prepare a user info
$user = array(
    'mail' => $data[$fields['mail']]['value'][0],
    'name' => $data[$fields['name']]['value'][0],
    'pass' => user_password(8),
    'status' => 1,
    'init' => $data[$fields['mail']]['value'][0],
    'roles' => array(2, 3),
);

$account = user_save(null, $user);  
}

1 Answer 1

1

If you are able to upgrade Webforms, preview functionality is now part of the 7.x-4.x branch of the Webform Module. There is an involved discussion about it here: Summary/review/preview page before final submission in multistep forms.

2
  • I can't use 7.x-4.x as it breaks all existing Forms on my site. I tried :-(
    – user219492
    Jul 11, 2014 at 21:17
  • Are you using a custom webform to create user info? Is this a new or existing user? or either? If you want to update an existing user, you need to load that in. When you say it doesn't work, what happens? (Or what do you expect to happen that doesn't?)
    – aburke626
    Jul 11, 2014 at 21:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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