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
Hello ktt, Please see: http://drupal.org/support for your support options. Regards Steven Jones ComputerMinds ltd - Perfect Drupal Websites Phone : 024 7666 7277 Mobile : 07702 131 576 Twitter : darthsteven http://www.computerminds.co.uk On 12 February 2010 15:36, ktt <kestutis98@yahoo.com> wrote:
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
Really that's how we roll on the Dev list now? "Hey thanks for coming, now get out." Esspecially when the answer is pretty simple. Ktt, The reason you are not inserting values is the '#tree' => TRUE, attribute set in your fieldset. This means that subsequent values will retain the array tree in $form_values. Therefore your $form_values in the db_query should look like this, $form_values['listname']['list_name'], $form_values['listname']['description']. I hope that helps. ----- Adam A. Gregory Drupal Developer & Consultant Web: AdamAGregory.com Twitter: twitter.com/adamgregory Phone: 910.808.1717 Cell: 706.761.7375 On Fri, Feb 12, 2010 at 10:40 AM, Steven Jones < steven.jones@computerminds.co.uk> wrote:
Hello ktt,
Please see: http://drupal.org/support for your support options.
Regards Steven Jones ComputerMinds ltd - Perfect Drupal Websites
Phone : 024 7666 7277 Mobile : 07702 131 576 Twitter : darthsteven http://www.computerminds.co.uk
On 12 February 2010 15:36, ktt <kestutis98@yahoo.com> wrote:
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
Hello, @ktt, apologies. I was blunt and meant to be, but meant no offence. @all - Can we rename the list to 'Development Support' and change the description to more accurately describe what this list offers to its members. Regards Steven Jones ComputerMinds ltd - Perfect Drupal Websites Phone : 024 7666 7277 Mobile : 07702 131 576 Twitter : darthsteven http://www.computerminds.co.uk On 12 February 2010 15:50, Adam Gregory <arcaneadam@gmail.com> wrote:
Really that's how we roll on the Dev list now? "Hey thanks for coming, now get out." Esspecially when the answer is pretty simple.
Ktt,
The reason you are not inserting values is the '#tree' => TRUE, attribute set in your fieldset. This means that subsequent values will retain the array tree in $form_values. Therefore your $form_values in the db_query should look like this, $form_values['listname']['list_name'], $form_values['listname']['description'].
I hope that helps. ----- Adam A. Gregory Drupal Developer & Consultant Web: AdamAGregory.com Twitter: twitter.com/adamgregory Phone: 910.808.1717 Cell: 706.761.7375
On Fri, Feb 12, 2010 at 10:40 AM, Steven Jones <steven.jones@computerminds.co.uk> wrote:
Hello ktt,
Please see: http://drupal.org/support for your support options.
Regards Steven Jones ComputerMinds ltd - Perfect Drupal Websites
Phone : 024 7666 7277 Mobile : 07702 131 576 Twitter : darthsteven http://www.computerminds.co.uk
On 12 February 2010 15:36, ktt <kestutis98@yahoo.com> wrote:
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
Steven/all: Regarding the purpose of this list... The list of lists page just says: http://drupal.org/mailing-lists Development - A list for Drupal developers. The list description says: http://lists.drupal.org/mailman/listinfo/development "The Development list exists for developers to be able to communicate with one another and discuss the technical issues around Drupal. Valid topics of discussions include code, patches, bug reports, and detailed suggestions for future code." This appears to say that development questions are encouraged on this list. It doesn't say you have to be an advanced, core developer to participate or that you cannot ask questions. And in general, we need to be welcoming in this community, and not tell new developers (who might eventually become core developers, contributed module maintainers, etc. with our support) to go away. That's my 2 cents anyway... --Jennifer Steven Jones wrote:
@ktt, apologies. I was blunt and meant to be, but meant no offence.
@all - Can we rename the list to 'Development Support' and change the description to more accurately describe what this list offers to its members.
-- Jennifer Hodgdon * Poplar ProductivityWare www.poplarware.com Drupal, WordPress, and custom Web programming
I'm just saying that the list name might need some clarification, it used to be about developing Drupal, but now seems to be about supporting people who want to develop for Drupal. It might be useful to change the name of this list to make this clear. On 12 Feb 2010, at 16:50, Jennifer Hodgdon <yahgrp@poplarware.com> wrote:
Steven/all:
Regarding the purpose of this list...
The list of lists page just says: http://drupal.org/mailing-lists Development - A list for Drupal developers.
The list description says: http://lists.drupal.org/mailman/listinfo/development "The Development list exists for developers to be able to communicate with one another and discuss the technical issues around Drupal. Valid topics of discussions include code, patches, bug reports, and detailed suggestions for future code."
This appears to say that development questions are encouraged on this list. It doesn't say you have to be an advanced, core developer to participate or that you cannot ask questions.
And in general, we need to be welcoming in this community, and not tell new developers (who might eventually become core developers, contributed module maintainers, etc. with our support) to go away.
That's my 2 cents anyway...
--Jennifer
Steven Jones wrote:
@ktt, apologies. I was blunt and meant to be, but meant no offence. @all - Can we rename the list to 'Development Support' and change the description to more accurately describe what this list offers to its members.
-- Jennifer Hodgdon * Poplar ProductivityWare www.poplarware.com Drupal, WordPress, and custom Web programming
Hello, Sorry if the question appeared too trivial. I tried "$form_values['listname']['list_name']" before with no success. Strangely. This worked for me - with "$form_values = $form_state['values'];" function contactlistcreate_submit($form, &$form_state) { $form_values = $form_state['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.')); } Thank you for benevolent answers. Regards, Ktt --- On Fri, 2/12/10, Adam Gregory <arcaneadam@gmail.com> wrote:
From: Adam Gregory <arcaneadam@gmail.com> Subject: Re: [development] Disapearing $form_values To: development@drupal.org Date: Friday, February 12, 2010, 5:50 PM Really that's how we roll on the Dev list now? "Hey thanks for coming, now get out." Esspecially when the answer is pretty simple.
Ktt,
The reason you are not inserting values is the '#tree' => TRUE, attribute set in your fieldset. This means that subsequent values will retain the array tree in $form_values. Therefore your $form_values in the db_query should look like this, $form_values['listname']['list_name'], $form_values['listname']['description'].
I hope that helps. ----- Adam A. Gregory Drupal Developer & Consultant Web: AdamAGregory.com Twitter: twitter.com/adamgregory Phone: 910.808.1717
Cell: 706.761.7375
On Fri, Feb 12, 2010 at 10:40 AM, Steven Jones <steven.jones@computerminds.co.uk> wrote:
Hello ktt,
Please see: http://drupal.org/support for your support options.
Regards
Steven Jones
ComputerMinds ltd - Perfect Drupal Websites
Phone : 024 7666 7277
Mobile : 07702 131 576
Twitter : darthsteven
http://www.computerminds.co.uk
On 12 February 2010 15:36, ktt <kestutis98@yahoo.com> wrote:
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
Oh duh, I totally glossed over that. Yeah in Drupal 6 form values are no longer stored in the $form_values variable and are now stored in the $form_state['values'] array ----- Adam A. Gregory Drupal Developer & Consultant Web: AdamAGregory.com Twitter: twitter.com/adamgregory Phone: 910.808.1717 Cell: 706.761.7375 On Fri, Feb 12, 2010 at 1:29 PM, ktt <kestutis98@yahoo.com> wrote:
Hello,
Sorry if the question appeared too trivial. I tried "$form_values['listname']['list_name']" before with no success. Strangely.
This worked for me - with "$form_values = $form_state['values'];"
function contactlistcreate_submit($form, &$form_state) { $form_values = $form_state['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.')); }
Thank you for benevolent answers.
Regards, Ktt --- On Fri, 2/12/10, Adam Gregory <arcaneadam@gmail.com> wrote:
From: Adam Gregory <arcaneadam@gmail.com> Subject: Re: [development] Disapearing $form_values To: development@drupal.org Date: Friday, February 12, 2010, 5:50 PM Really that's how we roll on the Dev list now? "Hey thanks for coming, now get out." Esspecially when the answer is pretty simple.
Ktt,
The reason you are not inserting values is the '#tree' => TRUE, attribute set in your fieldset. This means that subsequent values will retain the array tree in $form_values. Therefore your $form_values in the db_query should look like this, $form_values['listname']['list_name'], $form_values['listname']['description'].
I hope that helps. ----- Adam A. Gregory Drupal Developer & Consultant Web: AdamAGregory.com Twitter: twitter.com/adamgregory Phone: 910.808.1717
Cell: 706.761.7375
On Fri, Feb 12, 2010 at 10:40 AM, Steven Jones <steven.jones@computerminds.co.uk> wrote:
Hello ktt,
Please see: http://drupal.org/support for your support options.
Regards
Steven Jones
ComputerMinds ltd - Perfect Drupal Websites
Phone : 024 7666 7277
Mobile : 07702 131 576
Twitter : darthsteven
http://www.computerminds.co.uk
On 12 February 2010 15:36, ktt <kestutis98@yahoo.com> wrote:
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
This worked for me - with "$form_values = $form_state['values'];" What you did was change back to the Drupal 5 version, which is what your query was using. For Drupal 6, you should change "$form_values['list_name']" to "$form_state['values']['list_name']" etc.
Nancy E. Wichmann, PMP Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
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
participants (6)
-
Adam Gregory -
Jennifer Hodgdon -
ktt -
nan wich -
Steve Ringwood -
Steven Jones