Re: Quickform date comparison

From: Date: Thu, 01 Dec 2005 05:49:27 +0000
Subject: Re: Quickform date comparison
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22114@lists.php.net to get a copy of this message
On 11/30/05, email_fb-ml@yahoo.fr <email_fb-ml@yahoo.fr> wrote: > Hi all, > I would like to compare two date elements with > quickform but I didn't find how to do that in the > documentation, I need to test if $date_debut_session > > $date_fin_session > Is it possible with quickform ? > Thanks in advance for your help. > Fred > > $options = array( > 'language' => 'fr', > 'format' => 'dMYHi', > 'minYear' => 2005, > 'maxYear' => 2012 > ); > > $date_debut_session = & $form->addElement('date', > 'date_debut_session', _SESSIONDATEDEB, $options); > if (!isset($value[0]['date_debut_session'])) { > $date_debut_session->setValue(date("Y-m-d")); > } else { > > $date_debut_session->setValue($value[0]['date_debut_session']); > > } > > $date_fin_session = & $form->addElement('date', > 'date_fin_session', _SESSIONDATEFIN, $options); > if (!isset($value[0]['date_fin_session'])) { > $date_fin_session->setValue(date("Y-m-d")); > } else { > > $date_fin_session->setValue($value[0]['date_fin_session']); > > } > I suggets using a form rule (addFormRule) and the Date package. -- Justin Patrin

« previous php.pear.general (#22114) next »