Did you do a propel:build-forms after changing the schema? It should
change that integer validator to an sfValidatorNumber.

On Mon, May 18, 2009 at 07:13, Lawrence <lkrub...@geocities.com> wrote:
>
> I've got a field that was mistakenly defined in the schema as an
> integer. So the base class looks like this (I'm leaving out the
> irrelevant fields):
>
>    $this->setWidgets(array(
>      'payment_amount'    => new sfWidgetFormInput(),
>    ));
>
>    $this->setValidators(array(
>      'payment_amount'    => new sfValidatorInteger(),
>    ));
>
> This field is suppose to be an amount of cash, so it needs to have a
> decimal in it. When I first tried it, I input 1.5 and I got the error
> "Must be an integer."
>
> So I overrode it:
>
>    $this->widgetSchema['payment_amount'] = new sfWidgetFormInput
> ();
>    $this->validatorSchema['payment_amount'] = new sfValidatorString()
>
> I no longer get an error but when the form submits, the decimal is
> stripped off and I'm left with an integer.
>
> I've changed schema.yml so that payment_amount is now a float. I also
> changed the database itself, so that payment_amount is now a float.
>
> Yet the decimal still gets stripped off and it is rendered as an
> integer. Can anyone tell me where else I need to change this?
>
> >
>

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