Hi there,
I read all the stuff about validation..but....?? is it possible to jump to a spezial pagebreak, if a checkbox is selected? Some kind of dicision tree or logic?..
The checkbox validation I found, but what about the pagebreak? What kind of php code is it or not possible - JS perhabs?

Cheers Apfel007

Comments

Apfel007’s picture

Title: Validation question - jump to pagebreake » php logic field

What about using this php field? how can I get the variables?
I use this to display the array but .. how can I work with it? Jump to hiddenfields?

...
drupal_set_message('<pre>'. print_r($form_values, TRUE).'</pre>');

Could someone give me a help?

quicksketch’s picture

Component: Documentation » Code
Category: task » support

You can make Webform jump between pages using the Additional Processing field, but it's not easy. It's beyond the support I'll be able to provide considering the difficulty of the problem.

I can tell you that you can make Webform skip between pages by modifying the $form_state['values']['details']['page_num'] variable.

  if ($form_values['submitted_tree']['mycheckbox'] == 'somevalue' && $_POST['op'] == t('Next Page >')) {
    $form_state['values']['details']['page_num'] = 2; // This would make you skip to page 3 actually, since page number is incremented + 1.
  }

It gets even crazier since you'll need to make the "Previous Page" button work also to return to the previous page the user was on (no idea how you'd start doing this one). Again, since this is extremely difficult, I won't be able to provide more help than this.

quicksketch’s picture

Title: php logic field » Manually Implement Next/Previous Page Logic
Apfel007’s picture

Hi quicksketch,
thanks for the code.. I played with it several hours and try to understand with no luck.. I put it in the "Additional Processing:" but nothing happend - there must be a problem with the adding of the pagenum...
I can check the select box if selceted and give an error if is... that works! but the saving a new number in an array don't work fo me? I tried it with simple textfields, too. Whats wrong? If I compare this code with other it should work?...

cheers

quicksketch’s picture

Status: Active » Closed (fixed)

Closing after lack of activity. Note that there has been significant progress over in #254728: Conditional fields, which might provide what you're looking for.