I discovered "one" solution, though it looks a bit fishy to me.

Is this how you must set the messages?

And my first question still stands. In the email address validator below,
"messages" is an option. But where do I look in the source to know that I
can pass the option "messages"?

I am really interested in being able to figure this stuff out on my own. Can
anyone suggest some techniques I can use while looking at the Framework
source code in order to find solutions myself. I am getting better at
figuring out how things fit together when I look at the source, but in this
case, I was lost.

$this->addElement('text', 'email', array(
                'decorators' => $this->_defaultDecorators,
                'label' => 'Email Address',
                'required' => true,
                'validators' => array(
                    array(
                        'EmailAddress', false, array(
                            'messages' => array(
                                'emailAddressInvalid' => 'A valid Email
address is required',
                                'emailAddressInvalidHostname' => 'A valid
Email address is required',
                                'emailAddressInvalidMxRecord' => 'A valid
Email address is required',
                                'emailAddressDotAtom' => 'A valid Email
address is required',
                                'emailAddressQuotedString' => 'A valid Email
address is required',
                                'emailAddressInvalidLocalPart' => 'A valid
Email address is required'
                )))),
                'filters' => array('StringToLower'),
                'class' => 'text'
        ));


On Wed, Apr 22, 2009 at 8:50 AM, J DeBord <[email protected]> wrote:

> In the code below I have added the EmailAddress validator. In the case of
> this validator and the others, where can I find out what options I am able
> to pass to them?
>
> For example 'validators' => array(array('EmailAddress', false, array('WHAT
> OPTIONS CAN I PUT HERE?))),
>
> $this->addElement('text', 'email', array(
>                 'decorators' => $this->_defaultDecorators,
>                 'label' => 'Email Address',
>                 'required' => true,
>                 'validators' => array(array('EmailAddress', false,
> array())),
>                 'filters' => array('StringToLower'),
>                 'class' => 'text'
>         ));
>
> In this case I am interested in setting the invalid message for the
> emailaddress validator, but I think I can figure that out myself once I know
> how to determine exactly what options are available to be passed in the
> example above.
>
> So generally speaking about validators added in this context, how do I know
> what options are available to be set?
>
> Thanks a lot.
>

Reply via email to