Closed (works as designed)
Project:
Webform
Version:
7.x-4.x-dev
Component:
Code
Priority:
Minor
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
10 Sep 2012 at 23:40 UTC
Updated:
12 Sep 2012 at 01:57 UTC
What is the best way programmatically to see if I am on the first load of a webform (the initial load before the user hits submit).
I am currently doing something like:
function webform_hook_form_alter(&$form, &$form_state, $form_id) {
if(empty($form_state['input'])) {
// First pass
} else {
// Submitted at least once (and has not passed validation)
}
}
I don't want to lean on webform_hook_form_alter and empty($form_state['input']) if this will change in future versions.
Comments
Comment #1
quicksketchYou can check the page number in $form_state['webform']['page_num'].
Comment #2
quicksketchAh, well I misread your question. Checking for the presence of $form_state['submitted'] I think is the common approach for checking if *any* form in Drupal has been submitted and is doing processing.
Comment #3
jmoyles commentedThanks quicksketch!
Comment #3.0
jmoyles commentedRemoved a line of extraneous code