Re: [fw-general] Zend_Form: adding error messages to elements

2008-06-19 Thread pakmannen
First of all, thanks to Simon for providing an example. I had no idea about that $context thing, so thanks for the heads up. And thanks Matthew for considering adding this. I found the issue on the tracker and cast my vote. I'll follow your example and use addDescription for now. /Jens Ljungblad

Re: [fw-general] Zend_Form: adding error messages to elements

2008-06-19 Thread Matthew Weier O'Phinney
-- pakmannen <[EMAIL PROTECTED]> wrote (on Wednesday, 18 June 2008, 04:03 PM -0700): > Just started working with Zend_Form and I'm liking it so far. One thing I'm > wondering about though, which came up when I was working with a login form > using Zend_Auth. It would be great if there was a method

Re: [fw-general] Zend_Form: adding error messages to elements

2008-06-19 Thread Simon Mundy
Hi Jens No, just the one validator. Each validator can be passed a 'context' variable to make the validator aware of other values within the form. A quick 'n' dirty example:- 'The supplied username is invalid' ); public function isValid($value, $context = null) { if (!i

Re: [fw-general] Zend_Form: adding error messages to elements

2008-06-19 Thread pakmannen
Wouldn't I need two custom validators, one each for the username and password fields? Also, are you suggesting that I perform the authentication inside the custom validator? That doesn't feel very flexible but I don't know, maybe I'm missing something. Care to provide an example? I've been tryin

Re: [fw-general] Zend_Form: adding error messages to elements

2008-06-18 Thread Simon Mundy
Hi Jens As an alternative, you could write your own validator and attach it to the username element - the benefit being that you can automatically return those error messages and also transparently login the user at the same time. Cheers Hello List (and Matthew) Just started working w

[fw-general] Zend_Form: adding error messages to elements

2008-06-18 Thread pakmannen
Hello List (and Matthew) Just started working with Zend_Form and I'm liking it so far. One thing I'm wondering about though, which came up when I was working with a login form using Zend_Auth. It would be great if there was a method for adding error messages to an element with a public method. Th