Re: [fw-general] inArray validator

2009-10-14 Thread scs
Yes, you are right :)
For this validation, I am already using the in_array function. Yet
trying to find what is missing..

In this case, I may not be using the correct implementation (lets say
due to lack of knowledge and practice).
Just learning and implementing the learned things. If I found a better
practice, then I edit my codes in the project towards the ZF
convention and best implementation..

Thanks anyway ;)





On Wed, Oct 14, 2009 at 4:49 PM, Carlton Gibson  wrote:
> On 14 Oct 2009, at 14:44, scs wrote:
>
> In fact, I missed the ! operator on that line during editing the code
> on pastie  (now corrected version: http://pastie.org/654380).
> Unfortunately, the behaviour does not change when I correct that line.
> Still gives email domain is not allowed.
>
> Er... in that case I don't know. :-)
> Since you're not using the internal validator in a chain, and you're not
> using the error message, why don't you just use in_array() ? (i.e. you don't
> need any of the extra features that the Zend implementation gives you so why
> bother with the complication?)
> Regards,
> Carlton
>
>
>
>
>
> The allowed domains comes from application.ini file (debugged).
> the form element is also working fine (debugged).
> Yet only this validation...
>
>
> On Wed, Oct 14, 2009 at 4:23 PM, Carlton Gibson 
> wrote:
>
> On 14 Oct 2009, at 13:59, scs wrote:
>
> Hello,
>
> I have a custom validation class that validates if an e-mail domain is
>
> in the allowed domains list via the native inArray validator of Zend.
>
> Here is the code: http://pastie.org/654380
>
> However, the validator always returns false and gives the form error "
>
> email domain is not allowed " as in the validation class.
>
> If I do the check with the php's in_array function then I get the
>
> desired behaviour.
>
> Something missing?
>
> Yes. The test condition on Line 27 of your example needs a negation if you
>
> want to do the logic that way round. Either add or exchange the branch
>
> bodies.
>
> HTH
>
>
>


Re: [fw-general] inArray validator

2009-10-14 Thread Carlton Gibson

On 14 Oct 2009, at 14:44, scs wrote:


In fact, I missed the ! operator on that line during editing the code
on pastie  (now corrected version: http://pastie.org/654380).
Unfortunately, the behaviour does not change when I correct that line.
Still gives email domain is not allowed.



Er... in that case I don't know. :-)

Since you're not using the internal validator in a chain, and you're  
not using the error message, why don't you just use in_array() ? (i.e.  
you don't need any of the extra features that the Zend implementation  
gives you so why bother with the complication?)


Regards,
Carlton







The allowed domains comes from application.ini file (debugged).
the form element is also working fine (debugged).
Yet only this validation...


On Wed, Oct 14, 2009 at 4:23 PM, Carlton Gibson  
 wrote:


On 14 Oct 2009, at 13:59, scs wrote:


Hello,
I have a custom validation class that validates if an e-mail  
domain is
in the allowed domains list via the native inArray validator of  
Zend.

Here is the code: http://pastie.org/654380

However, the validator always returns false and gives the form  
error "

email domain is not allowed " as in the validation class.
If I do the check with the php's in_array function then I get the
desired behaviour.

Something missing?


Yes. The test condition on Line 27 of your example needs a negation  
if you
want to do the logic that way round. Either add or exchange the  
branch

bodies.

HTH





Re: [fw-general] inArray validator

2009-10-14 Thread scs
In fact, I missed the ! operator on that line during editing the code
on pastie  (now corrected version: http://pastie.org/654380).
Unfortunately, the behaviour does not change when I correct that line.
Still gives email domain is not allowed.


The allowed domains comes from application.ini file (debugged).
the form element is also working fine (debugged).
Yet only this validation...


On Wed, Oct 14, 2009 at 4:23 PM, Carlton Gibson  wrote:
>
> On 14 Oct 2009, at 13:59, scs wrote:
>
>> Hello,
>> I have a custom validation class that validates if an e-mail domain is
>> in the allowed domains list via the native inArray validator of Zend.
>> Here is the code: http://pastie.org/654380
>>
>> However, the validator always returns false and gives the form error "
>> email domain is not allowed " as in the validation class.
>> If I do the check with the php's in_array function then I get the
>> desired behaviour.
>>
>> Something missing?
>
> Yes. The test condition on Line 27 of your example needs a negation if you
> want to do the logic that way round. Either add or exchange the branch
> bodies.
>
> HTH
>


Re: [fw-general] inArray validator

2009-10-14 Thread Carlton Gibson


On 14 Oct 2009, at 13:59, scs wrote:


Hello,
I have a custom validation class that validates if an e-mail domain is
in the allowed domains list via the native inArray validator of Zend.
Here is the code: http://pastie.org/654380

However, the validator always returns false and gives the form error "
email domain is not allowed " as in the validation class.
If I do the check with the php's in_array function then I get the
desired behaviour.

Something missing?


Yes. The test condition on Line 27 of your example needs a negation if  
you want to do the logic that way round. Either add or exchange the  
branch bodies.


HTH


[fw-general] inArray validator

2009-10-14 Thread scs
Hello,
I have a custom validation class that validates if an e-mail domain is
in the allowed domains list via the native inArray validator of Zend.
Here is the code: http://pastie.org/654380

However, the validator always returns false and gives the form error "
email domain is not allowed " as in the validation class.
If I do the check with the php's in_array function then I get the
desired behaviour.

Something missing?

scs