I've created a basic webform with 3 wizard pages & 3 textfields. All using basic settings. I'm altering some stuff using hook_form_alter. I've noticed going from step 1 to step 2 always calls hook_form_alter twice. I dumped the form_id, so I'm sure it's the same form. In the first call form_state values are empty, which breaks my functionality.

webform

CommentFileSizeAuthor
Screenshot 2019-08-30 at 13.57.04.png49.91 KBbeljaako

Comments

beljaako created an issue. See original summary.

jrockowitz’s picture

Status: Needs review » Closed (works as designed)

Form alter hooks are executed when the form first loads then when it is rebuilt during the page request.

I recommend using $form_state->isRebuilding() to determine if the form is being rebuilt.