Hello,
I think it's just a matter of validator. When the form is submitted
the validator 'reformat' the value (the doClean method). So you can
implement your own sfValidatorExtraNumber to take any kind of float :
- 1, 000.00
- 1000,00
- 1 000.00
- etc...
and return a valid php float number.
But, if you want to display the float number properly to the end user
you have also to reimplement a widget as you did.
Thomas
On Mon, Oct 13, 2008 at 9:49 PM, Bruno Reis <[EMAIL PROTECTED]> wrote:
>
> Hi there,
>
> I made the following class to render my decimal numbers with commas
> instead of dots. But if the form does not validate, then the render
> function is called with the user entered value. So the first time, for
> instance, its called with 14.54(dot) to show the form. It is shown as
> 14,54(comma). When the user submits the form (that is not validated) ,
> then its called with 14,54 (comma) and does not work as expected.
>
> Am I doing something wrong here?
> Is the Class right implemented?
>
> thks,
> Bruno
>
> -----
>
> class sfWidgetFormInputDecimal extends sfWidgetForm
> {
>
> protected function configure($options = array(), $attributes = array())
> {
> parent::configure($options,$attributes);
> $this->addRequiredOption('culture');
> }
>
>
> public function render($name, $value = null, $attributes = array(),
> $errors = array())
> {
> $numberFormat = new sfNumberFormat($this->getOption('culture'));
> $value = $numberFormat->format($value);
> return $this->renderTag('input', array_merge(array('type' =>
> $this->getOption('type'), 'name' => $name, 'value' => $value),
> $attributes));
> }
> }
>
> >
>
--
Thomas Rabaix
Internet Consultant
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---