Perhaps try using strlen() function instead of empty() function and see if
that makes a difference.

On Thu, May 5, 2011 at 7:27 AM, Raju <yadavrajesh25j...@gmail.com> wrote:

>
>    $this->setValidators(array(
>
>      'charge_type'            => new
> sfValidatorChoice(array('choices' => array(0 => 'percent', 1 =>
> 'flat'), 'required' => false)),
>      'upper_slab'             => new
> sfValidatorNumber(array('min'=>0,'required' => false)),
>
>
>    ));
>
>
>
>   $this->validatorSchema->setPostValidator(
>         new sfValidatorAnd(array(
>
>               new
> sfValidatorCallback(array('callback'=>array($this,'upperValidation'))),
>
>        ))
>   );
>
>
>  public function upperValidation($validator, $values)
>  {
>        if($values['charge_type']=='percent') {
>
>            if(empty($values['upper_slab']))
>            {
>               $error = new sfValidatorError($validator, "Upper Slab
> Required");
>               throw new sfValidatorErrorSchema($validator,
> array('upper_slab' => $error));
>
>            }
>
>
>        }
>        return $values;
>
>
>   }
>
>
> here i got message  "fasd" is not a number. Upper Slab Required .
>
> i want to show here only "fasd" is not a number.
>
> and when value is blank it will show Upper Slab Required .
>
>
>
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>



-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc
identi.ca: @garethmcc

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to