agaskar.com

Aug 20 2007

A Common FormAPI error in Drupal.

Whenever you see:

Fatal error: Cannot use string offset as an array in drupal/includes/form.inc on line 677
You should immediately think: “Damn, I tried to set a form element equal to a string.” meaning $form[‘foo’]=’bar’; needs to, at the very least, be: $form[‘foo’]=array(‘#value’=>’bar’); This is an easy thing to over-tech — hopefully this page saved you some debugging.

Comments (View)
Page 1 of 1
blog comments powered by Disqus