[symfony-users] sfValidatorChoice always invalid!!

2010-02-19 Thread wueb
Hi mates,

I'm having a problem in this piece of code:

$modulos = array ( 1 = option 1, 2 = option 2);

$this-widgetSchema['id_modulo'] = new sfWidgetFormSelectCheckbox(
array('choices'  = $modulos)
);

$this-validatorSchema['id_modulo'] = new sfValidatorChoice(
array('choices'  = $modulos)
);


I have a checkbox and a validator. The problem is when i submit the
form, the checkbox validator send me always a Invalid. message!!

Anyone have a idea why is this happening?

-- 
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-us...@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.



Re: [symfony-users] sfValidatorChoice always invalid!!

2010-02-19 Thread Syam

You must only pass the keys of your $modulo array to validator :

$this-validatorSchema['id_modulo'] = new sfValidatorChoice(
  array('choices'  = array_keys($modulos))
);


wueb wrote:

Hi mates,

I'm having a problem in this piece of code:

$modulos = array ( 1 = option 1, 2 = option 2);

$this-widgetSchema['id_modulo'] = new sfWidgetFormSelectCheckbox(
array('choices'  = $modulos)
);

$this-validatorSchema['id_modulo'] = new sfValidatorChoice(
array('choices'  = $modulos)
);


I have a checkbox and a validator. The problem is when i submit the
form, the checkbox validator send me always a Invalid. message!!

Anyone have a idea why is this happening?

  


--
You received this message because you are subscribed to the Google Groups symfony 
users group.
To post to this group, send email to symfony-us...@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.