I have this coded in my form: $form['created_before'] = array( '#title' => t('created before'), '#type' => 'date', '#validate' => 'date_validate', '#submit' => 'cmf_date_submit', '#default_value' => array('year' => date('Y'), 'month' => 12, 'day' =>31), '#prefix' => '<div class="date-inline">', '#suffix' => '</div>', ); The validate function is being called, but the submit function is not. Yes, there is a form submit button. Why is the submit function not being called? Nancy E. Wichmann, PMP Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
You can have a validate handler on any element, but not a submit handler. You'll need to add it to the $form collection. On Saturday, August 8, 2009, Nancy Wichmann <nan_wich@bellsouth.net> wrote:
I have this coded in my form:
$form['created_before'] = array( '#title' => t('created before'), '#type' => 'date', '#validate' => 'date_validate', '#submit' => 'cmf_date_submit', '#default_value' => array('year' => date('Y'), 'month' => 12, 'day' =>31), '#prefix' => '<div class="date-inline">', '#suffix' => '</div>', );
The validate function is being called, but the submit function is not. Yes, there is a form submit button. Why is the submit function not being called? Nancy E. Wichmann, PMP
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
-- Regards Steven Jones ComputerMinds ltd - Perfect Drupal Websites Phone : 024 7666 7277 Mobile : 07951 270 026 Twitter : darthsteven http://www.computerminds.co.uk
Thanks. Looking at the Forms API, I don't see one bit of difference between #submit and #validate. Perhaps a clarification is needed. Nancy E. Wichmann, PMP Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr. -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org]On Behalf Of Steven Jones Sent: Saturday, August 08, 2009 2:25 PM To: development@drupal.org Subject: Re: [development] Submit handler not getting called You can have a validate handler on any element, but not a submit handler. You'll need to add it to the $form collection. On Saturday, August 8, 2009, Nancy Wichmann <nan_wich@bellsouth.net> wrote:
I have this coded in my form:
$form['created_before'] = array( '#title' => t('created before'), '#type' => 'date', '#validate' => 'date_validate', '#submit' => 'cmf_date_submit', '#default_value' => array('year' => date('Y'), 'month' => 12, 'day' =>31), '#prefix' => '<div class="date-inline">', '#suffix' => '</div>', );
The validate function is being called, but the submit function is not.
Yes,
there is a form submit button. Why is the submit function not being called? Nancy E. Wichmann, PMP
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
-- Regards Steven Jones ComputerMinds ltd - Perfect Drupal Websites Phone : 024 7666 7277 Mobile : 07951 270 026 Twitter : darthsteven http://www.computerminds.co.uk No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.392 / Virus Database: 270.13.45/2284 - Release Date: 08/08/09 06:10:00
Nancy Wichmann wrote:
Thanks. Looking at the Forms API, I don't see one bit of difference between #submit and #validate. Perhaps a clarification is needed.
The first poster was incorrect. You can use #element_validate on any element, not #validate. The Form API doc is correct. --Jennifer -- Jennifer Hodgdon * Poplar ProductivityWare www.poplarware.com Drupal, WordPress, and custom Web programming
participants (3)
-
Jennifer Hodgdon -
Nancy Wichmann -
Steven Jones