Laravel Blade form money/currency format
I know it's not the "Laravel" way of doing that, but if you're looking for a nice, clean way to show your customers the currency in a format you can than process on your server side i would recommend using jQuery formatcurrency:
Demo: http://www.bendewey.com/code/formatCurrency/demo/
Docs & Download:
https://code.google.com/p/jquery-formatcurrency/wiki/Usage
Than, if you want to make it a nice looking currency input on blur just use:
$('.currency').blur(function()
{
$('.currency').formatCurrency();
});
I know it's now perfect, but it worked for me and i loved it :)
Admin
Updated on June 04, 2022Comments
-
Admin almost 2 years
I am building a form in Laravel (4.2) with Blade.
There are many options for input types. But, how do I set in input field set as an currency field? When I want to enter the money I paid for a product for example?
{{ Form::label('money', 'money:') }} {{ Form::number('money') }}
I wanted the input field to become a number with a comma for separation and two digits after it:
€ |input field here|,|inputfield for digits|
I want it to display like. € 150 , 54
Can you tell me what to do, please? An explanation with link to some docs would be great! The Laravel docs at http://laravel.com/docs/4.2/html#number aren't really helpfull
Thanks in advance!
-
Admin over 8 yearsThanks a lot! My programming style isn't the cleanest. I often look for hacks or other ways to do so, so this helps me a lot! Thanks :-)