Viewing the $form and $form_state arrays when working with Webforms


Viewing the $form and $form_state arrays when working with Webforms

by Sean Corrales

Recently I was working on an additional validation script for a webform on a client’s site. It was particularly frustrating because I couldn’t seem to locate the variable I needed for my validation.

I didn’t see this anywhere else but this helped a ton and, after figuring this out, I was able to knock out the validation script in five minutes.

Just place the following code in the “Additional Processing” field. To see the $form variable, simply switch it with $form_state in the following code snippet.



After saving this, simply fill out your webform and submit it; you should then see an entire display of the $form_state array to make validation and processing scripts a lot easier to put together. In order to view the array displayed with proper spacing, use the "View Source" option in your browser.

More About the Author

Sean Corrales

Lead Web Developer
Internet Explorer ignoring CSS files Like most web developers, I do most of my development work in one browser (in my case, Firefox) and then do cross browser checks after ...
Creating checkout panes for Ubercart All code comes from a shipping insurance module I wrote for Ubercart. I plan to release it on and after I ...

See more from this author →

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK


Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Geschäftsführer: Mel Stephenson

Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072


Love our blog? You should see our emails. Sign up for our newsletter!