How to run custom function after clicking next on a multi page webform I've created a multi page webform and I want to run a function after the user clicks the 'Next page' button on the first page only. After the user fills in the data on the first page, I want to grab that data and do stuff with it. After that the webform should work like normal on through the submission process.

How can I do this so that the function runs only once? I've tried using hook_form_alter and testing the value of $form['details']['page_num']['#value']. This value is 2 if I'm on the second page. For some reason the function fires twice and I can't figure out why.

Thanks
One way to accomplish this task, because the webform module is so complex, is to just use jQuery and attach to that button and node id and run an AJAX query or whatever else you want to do like redirect the user away and then back.

Otherwise you would probably be neck deep in a custom module that extends Webform. In my experience to alter webform modules becomes a major pain and I generally just go another route.