i want to process my form to get zodiac symbol by the date so i need to use my function and save the symbol in the profile's table so, wich tools can you give me to process this form?
thanks

Comments

quicksketch’s picture

Currently the only options for hooking into the Webform processing are:
- hook_form_alter() to add a #submit or #validate handler that can use form_set_value() to set a value to be saved
- The additional processing and validation fields located under "Webform advanced settings" when editing the Webform. You can set the values of the form into the $form_values['submitted'] array and they will be saved into the database.

jruberto’s picture

Quicksketch, I'm (using 5.x-2.1.2) trying to do exactly what you recommend in your second bullet point and get errors:

code sample from "Additional Processing":

//  other code above here crunching numbers
//  based on values entered in webform fields
$t = $t1 + 40 - $t2;
$r = $r1 + 40 - $r2;
$form_values['submitted']['t'] = $t;  // field is called t
$form_values['submitted']['r'] = $r;  // field is called r

results in:
user warning: Duplicate entry '6-0-0' for key 1 query: INSERT INTO webform_submitted_data (nid, sid, cid, no, data) VALUES (2, 6, 0, 0, '6') in /srv/www/drupal-5.1/includes/database.mysql.inc on line 172.

The the nid and the sid are correct, but the cid is always zero, and I don't know what no is. Each time the form is submitted, one entry does wind up inserted into webform_submitted_data with a cid of zero. Of course that works once, then results in a duplicate key error for subsequent attempts.

The field I am referencing has been defined as a hidden field (tho I did get the same result trying it with a textfield). This is a multi-page form, and all the hidden fields are on the last page. I have tried setting default values in the field definition and that makes no difference. Run out of things to try. Any thoughts? Thanks so much.

jruberto’s picture

and of course the $form_values['submitted'] array is indexed by cid, not by field name, hence the missing cid. sometimes all it takes is posting it to make the answer totally clear. :)

//  other code above here crunching numbers
//  based on values entered in webform fields
$t = $t1 + 40 - $t2;
$r = $r1 + 40 - $r2;
$form_values['submitted'][43] = $t;  // field is called t
$form_values['submitted'][44] = $r;  // field is called r

works like a charm.

quicksketch’s picture

Title: process the from by myself » Process the from by myself
Category: feature » support
Status: Active » Fixed

Fantastic juberto :)

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.