Solved.
I added hook_form_alter and checked if I am working with webforms (I suppose you can check if you are working with a specific webform), and then added a custom validation call-back:
if (strstr($form_id, 'webform_client_form') !== FALSE) {
if (empty ($form['#validate']['_set_next_page'])) {
$form['#validate'][] = '_set_next_page';
}
}
In the _set_next_page function I get the value of the submitted component. In my case there is only one question per page, but you can easily adapt that
$submitted = array_keys($form_state['values']['submitted']);
Remember if this is the first page (question), the array looks slightly different, so:
if ($form_state['webform']['page_num'] == 1) {
$Q = $submitted[0];
}
else {
$Q = $submitted[1];
}
// Get the value that was submitted
$value = $form_state['values']['submitted'][$Q];
Assuming $destination holds the 'form_key' of the question you want to jump too:
if ($destination) {
foreach ($node->webform['components'] as $component) {
if ($component['form_key'] == $destination) {
$nextPage = $component['page_num'] - 1;
if (($nextPage > 1)
&& ($nextPage < $form_state['webform']['page_count']))
{
$form_state['webform']['page_num'] = $nextPage;
break;
}
}
}
}
I set the page_num to the page_number for the destination component to one less, because webforms will increment this value once the submission is processed.
I am sure the code needs some re-finement (make sure that I do not crash and burn while accessing array elements / objects that does not exist) - but you get the idea.
Hope this helps someone else.