It looks like you're adding the custom compareDates validator to both date
elements. It might be easier to just put it in one.

If you can determine that $a < $b, then you already know that $b > $a.

Also, in the $evtStartDate element, you are setting the field to compare to
$evtEndDate, which hasn't been created yet. Instead of passing in the
element, try passing in the element's field name "evt_enddate" (as a
string).

I hope this helps.

--
Hector


On Wed, Dec 30, 2009 at 5:16 AM, Jigal sanders <[email protected]>wrote:

> Hello everyone,
>
>
> I have a form with two date fields. One startdate and one enddate. I want
> to make sure, the end date is not before the startdate.
> I am trying to create my own validator. Now i based my validator on this
> tutorial:
> http://cogo.wordpress.com/2008/04/16/custom-validators-for-zend_form_element/
> Here is my code: http://pastebin.com/f20aafd32  it's not yet ready.
> My problem is at line 52 where the value of  $this->_fieldsToCompare is
> empty all the time.
> I also have problems in comparing the dates.
>
> Kan someone please help me along?
>
>
> <http://cogo.wordpress.com/2008/04/16/custom-validators-for-zend_form_element/>
>
> Kind regards,
>
> J. Sanders
>

Reply via email to