2008/9/30 Matthew Weier O'Phinney <[EMAIL PROTECTED]>
>
> -- 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.

I know, I just tried copying the setAttribs values from another field,
which in this case was a textarea. I just added them to let the error
stop. Because it said i didn't supply attribs, I just added at least
something, to see if it works.


> >         ->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.

I mean that I added 3 empty arrays to this line:
$oEmail = new Zend_Dojo_Form_Element_ValidationTextBox('email',
array(), array(), array());

But that was just a wild guess, after a few hours of trying and trying...


>
> > 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.

Okay, I already thought it would be possible.
But I am still having this error.

I posted my code here: http://pastebin.com/m193743a8
This is a method which i made inside my contactForm controller. Maybe
you could have a look at it?

Also, do you know a better way to create this form? I mean, I now had
some issues with the submit button. I had to add it separate because
it didn't need the <label for="bla"> tag. But that is not the most
important thing for now.

Reply via email to