[support] form attributes #id
Earnie Boyd
earnie at users.sourceforge.net
Fri Apr 10 11:45:24 UTC 2009
Quoting Ivan Sergio Borgonovo <mail at webthatworks.it>:
> On Fri, 10 Apr 2009 11:26:29 +0200
> Davide Michel 'ZioBudda' Morelli <michel at 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/
More information about the support
mailing list