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