[development] Disapearing $form_values

Steve Ringwood nevets at tds.net
Fri Feb 12 15:49:41 UTC 2010


Since you set #tree to TRUE for 'listname' you need to use 
$form_values['listname']['list_name'] and 
$form_values]['listname']['description'] to get the values

Nevets
> Hello,
>
> I have a form:
>
> function contactlistcreate() {
>   $form = array();
>   
>   $form['listname'] = array(
>     '#type' => 'fieldset', 
>     '#title' => t('Create new list'),
>     '#tree' => TRUE,
>   );
>   $form['listname']['list_name'] = array(
>     '#type' => 'textfield', 
>     '#title' => t('List name'), 
>     '#size' => 30, 
>     '#maxlength' => 64, 
>     '#description' => t('Enter the list name'),
>     '#default_value' => 'dddodododod',
>   );
>   $form['listname']['description'] = array(
>     '#type' => 'textarea', 
>     '#title' => t('Describe it'), 
>     '#cols' => 60, 
>     '#rows' => 5, 
>     '#description' => t('List description.'),
>   );
>   $form['listname']['submit'] = array('#type' => 'submit', '#value' => t('Save'));
>   return $form;
> }
>
> and submit function:
>
> function contactlistcreate_submit($form_id, $form_values) {
>   db_query(
>     "INSERT INTO {contactsliststable} (contacts_list_name, contacts_list_description) VALUES ('%s', '%s')", $form_values['list_name'], $form_values['description']);
>     drupal_set_message(t('Your list has been saved.'));
> }
>
> But it inserts only empty values to database table and throw no errors..
>
>
> Regards,
> Ktt
>
>
>       
>
>
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20100212/f089f508/attachment.html 


More information about the development mailing list