hye,

I'am creating a module and i got 2 errors :

fist when i try to go inside my content type (content/types);

warning: Missing argument 1 for drupal_get_form() in C:\wamp\www\drupal-6.20\includes\form.inc on line 71.

warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in C:\wamp\www\drupal-6.20\includes\form.inc on line 378.

I guess it provide from hook form.. code look ok

function shopping_list_form(&$node, $form_state) {

    $type = node_get_types('type', $node);

    //champs standart :
    $form['title'] = array(
        '#type' => 'textfield',
        '#title' => check_plain($type->title_label),
        '#default_value' => $node->title,
        '#required' => TRUE,
    );
    $form['body'] = array(
        '#type' => 'textarea',
        '#title' => check_plain($type->body_label),
        '#default_value' => $node->body,
        '#rows' => 20,
        '#required' => TRUE,
    );
    $form['filter'] = filter_form($node->format);

    //champs personnalisés
    if ($node->shopping_date)
        $date = date('D/m/Y', $node->shopping_date);
    else
        $date = date('D/m/Y', time());
    $date = explode("/", $date);

    $form['shopping_date'] = array(
        '#type' => 'date',
        '#title' => t('Date des courses'),
        '#default_value' => array(
            'year' => (int) $date[2],
            'month' => (int) $date[1],
            'day' => (int) $date[0]
        ),
        'description' => t('Choisissez la date de ces courses'),
    );
    $form['shopping_amount'] = array(
        '#type' => 'textfield',
        '#title' => t('Montant prévisionnel'),
        '#default_value' => $node->shopping_amount,
        '#description' => t('Saisissez le montant prévisionnel de vos courses')
    );
    return $form;
}

And when i try to create content (node/add);

Fatal error: Cannot use string offset as an array in C:\wamp\www\drupal-6.20\includes\form.inc on line 992

Have you ever seen this errors before?

Merci

Comments

Anonymous’s picture

Just a tiny mistake: the 'description' key in your 'shopping_date' element should be '#description'. Anything not prefixed with a # is treated as a form element, which should be an array,

Anonymous’s picture

EDIT never mind that was wrong!

Linternautilus’s picture

Thanks a lot! :)