2

I have multiple page breaks in a webform. Can I get all the values submitted in all previous page break? Actually I can get only the values for one previous page break(the last one submitted).

For example if i'm in the page break 4 only can request the values submitted in page break 3 not in all the previous (2 and 1). The other values are not present.

I'm using the hook_form_alter.

Getting the info from $form_state["input"]["submitted"]

    function custom_module_form_alter(&$form, &$form_state, $form_id) {    
      if(substr($form_id,0,20 ) == 'webform_client_form_') {   
        dsm($form_state["input"]["submitted"]);
        //Only info from one page break(previous)
      } 
    }

1 Answer 1

0

You can retrieve submitted values across all pages from $form_state['storage']['submitted'].

Note that this represents values from past pages and not the current page. Here is the code I use to get them all (past & current) page values into a single array:

$values = _webform_client_form_submit_flatten($node, $form_state['values']['submitted']);
$values += $form_state['storage']['submitted'];
3
  • Thanks! Works fine. (My php version don't admit "+=", I used function "array_replace")
    – rubofvil
    Commented Jun 19, 2015 at 8:50
  • @rubofvil Glad to help. Please click the checkbox and the up arrow next to this answer.
    – Coleman
    Commented Jun 19, 2015 at 13:35
  • I don't have enough points yet to vote, sorry.(I will do)
    – rubofvil
    Commented Jun 22, 2015 at 11:22

Your Answer

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

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