Hi all. I have this form: $form = array( //'#id', 'user_register_new2', '#method' => 'get', '#action' => '#', '#attributes' => array('onsubmit' => 'javascript: return false'), '#prefix' => '-------------------<br><div id="form_user_register_new" class="form_user_register_new">', '#suffix' => '</div>-------------------<br>' ); Note the '#id'. Without it the form is correctly rendered, with it php return me this error: PHP Fatal error: Cannot use string offset as an array in /opt/apache/htdocs/budda/includes/form.inc on line 976 This is my code: function zb_user_register($data) { return drupal_get_form('zb_user_register_form'); } function zb_user_register_form($data) { //var_dump($data); $form = array( //'#id', 'user_register_new2', '#method' => 'get', '#action' => '#', '#attributes' => array('onsubmit' => 'javascript: return false'), '#prefix' => '-------------------<br><div id="form_user_register_new" class="form_user_register_new">', '#suffix' => '</div>-------------------<br>' ); $form['firstname'] = array( '#weight' => -10, '#type' => 'textfield', '#title' => t('First name'), '#maxlength' => '60', '#description' => t('Insert here the description for this type of element'), '#required' => true, '#size' => 60, '#id' => 'firstname-field' ); return $form; } I'm using Drupal 6.10. M. -- Michel 'ZioBudda' Morelli michel@ziobudda.net Consulenza sistemistica in ambito OpenSource. Sviluppo applicazioni web dinamiche (LAMP+Ajax) Telefono: 0200619074 Telefono Cell: +39-3939890025 -- Fax: +39-0291390660 http://www.ziobudda.net ICQ: 58351764 http://www.ziobuddalabs.it Skype: zio_budda http://www.ziodrupal.net MSN: michel@ziobuddalabs.it JABBER: michel@ziobuddalabs.it
On Fri, 10 Apr 2009 11:26:29 +0200 Davide Michel 'ZioBudda' Morelli <michel@ziobudda.net> wrote:
Hi all. I have this form:
$form = array( //'#id', 'user_register_new2', '#method' => 'get', '#action' => '#', '#attributes' => array('onsubmit' => 'javascript: return false'), '#prefix' => '-------------------<br><div id="form_user_register_new" class="form_user_register_new">', '#suffix' => '</div>-------------------<br>' );
Note the '#id'. Without it the form is correctly rendered, with it php return me this error:
PHP Fatal error: Cannot use string offset as an array in /opt/apache/htdocs/budda/includes/form.inc on line 976
This is my code:
function zb_user_register($data) { return drupal_get_form('zb_user_register_form'); }
function zb_user_register_form($data) { //var_dump($data);
$form = array( //'#id', 'user_register_new2',
where is the => ??? -- Ivan Sergio Borgonovo http://www.webthatworks.it
Quoting Ivan Sergio Borgonovo <mail@webthatworks.it>:
On Fri, 10 Apr 2009 11:26:29 +0200 Davide Michel 'ZioBudda' Morelli <michel@ziobudda.net> wrote:
Hi all. I have this form:
$form = array( //'#id', 'user_register_new2', '#method' => 'get', '#action' => '#', '#attributes' => array('onsubmit' => 'javascript: return false'), '#prefix' => '-------------------<br><div id="form_user_register_new" class="form_user_register_new">', '#suffix' => '</div>-------------------<br>' );
Note the '#id'. Without it the form is correctly rendered, with it php return me this error:
PHP Fatal error: Cannot use string offset as an array in /opt/apache/htdocs/budda/includes/form.inc on line 976
This is my code:
function zb_user_register($data) { return drupal_get_form('zb_user_register_form'); }
function zb_user_register_form($data) { //var_dump($data);
$form = array( //'#id', 'user_register_new2',
where is the =>
Right should be #id => 'user_register_new2', but you don't need it as the id is auto-generated based on the callback name if not specified. -- Earnie -- http://r-feed.com/ -- http://for-my-kids.com/ -- http://www.4offer.biz/ -- http://give-me-an-offer.com/
Ivan Sergio Borgonovo ha scritto:
Hi all. I have this form:
$form = array( //'#id', 'user_register_new2', '#method' => 'get',
where is the =>
???
Stupid, Stupid, Stupid, Stupid, Stupid, Stupid, Stupid, Stupid, Stupid, Stupid, Stupid, Stupid, Stupid, Why ?? Why am I so stupid ??????? grrrrrrrrrrr Tnx Ivan (have you an skype account ? ) -- Michel 'ZioBudda' Morelli michel@ziobudda.net Consulenza sistemistica in ambito OpenSource. Sviluppo applicazioni web dinamiche (LAMP+Ajax) Telefono: 0200619074 Telefono Cell: +39-3939890025 -- Fax: +39-0291390660 http://www.ziobudda.net ICQ: 58351764 http://www.ziobuddalabs.it Skype: zio_budda http://www.ziodrupal.net MSN: michel@ziobuddalabs.it JABBER: michel@ziobuddalabs.it
participants (3)
-
Davide Michel 'ZioBudda' Morelli -
Earnie Boyd -
Ivan Sergio Borgonovo