-- Jan Smit <[EMAIL PROTECTED]> wrote
(on Tuesday, 30 September 2008, 01:22 AM +0200):
> I tried to create a form with this code:
> 
> $oEmail = new Zend_Dojo_Form_Element_ValidationTextBox('email');
> $oEmail->addValidator('EmailAddress')
>         ->setRequired(true)
>         ->setLabel('Your e-mailaddress:')
>         ->setAttribs(array('rows' => '10', 'cols' => '40'))

The above line makes no sense; ValidationTextBox is a standard text
input field, not a textarea.

>         ->setInvalidMessage("Oh noo, it's invalid!")
>         ->setRegExp("A long regexp");
> 
> Now when i execute this code, I get this as result:
> 
> Catchable fatal error: Argument 4 passed to
> Zend_Dojo_View_Helper_ValidationTextBox::validationTextBox() must be an array,
> null given in /Users/***/***/***/library/Zend/Dojo/View/Helper/
> ValidationTextBox.php on line 64

I cannot recreate this. Even with the rows and cols as set above,
everything works properly for me.

> As you can see: I tried adding the setAttribs method to solve this, because
> afaik the fourth Argument in the error is about attribs.

Yes, that is correct.

> I also tried to add four elements to the first code line, but that didn't work
> either.

No idea what you mean by this statement.

> Any ideas?
> 
> Also, I would like to know if it is possible to use both Zend_Form's
> validation, and Zend_Dojo validation, to ensure validation when someone have
> javascript disabled or so.

Yes, of course. The validators set with addValidator(), addValidators(),
and setValidators() work on the server side; using setRegExp() and other
element-specific validation with the Dijit elements will work for the
client side.

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to