Wednesday, May 27, 2009

Re: Forms with math computations and multiple buttons

OK, I understand. Why don't you use the currency method?

http://api.cakephp.org/class/number-helper#method-NumberHelpercurrency

You might want to override the defaults with the $options array if you
don't want a dollar sign, etc.

Note that the comment for format() method ("Formats a number into a
currency format.") is bogus. That's just been copied from currency().

On Wed, May 27, 2009 at 9:30 PM, espontaneo <acohlngto@gmail.com> wrote:
>
>
> Isn't the number helper the equivalent of number_format()? How can I format
> the computed values coming from my component?
>
> part of my controller code:
> $this->data['Model']['field'] = $this->component->function($salary). '.00';
>
> If you notice the . '.00' I have in my code above, I'm having problems with
> formatting the computed values in a money format. For the meantime, I'm
> concatenating the result with the decimal point. But I want to format it
> properly. I've tried to use the number helper and I've searched through the
> net about this, but I can't get enough information.
>
>
> brian-263 wrote:
>>
>>
>> I'm not sure what you mean. sprintf()?
>>
>> http://www.php.net/manual/en/function.sprintf.php
>>
>>
> --
> View this message in context: http://www.nabble.com/Forms-with-math-computations-and-multiple-buttons-tp23718059p23753775.html
> Sent from the CakePHP mailing list archive at Nabble.com.
>
>
> >
>

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

No comments: