TOPIC:

How to show a TOTAL field for a sum fields with dots as thousands separators? 1 month 2 days ago #272959

  • Topic Author
  • carlos.carrasco@live.cl
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • ...
  • Posts: 7
  • Thanks: 0
Hi

I have this code , sum of two fields and total shows the sum. but i need to show the result this way, example: 10.000 (dot) not 10000 neither 10,000 (commas)

this is the code I'm using
thanks
function ff_sumacampos_init()
{
setInterval('suma()',500);
} // ff_sumacampos_init

function suma() {
var total=
Number(ff_getElementByName('monto1').value) + 
Number(ff_getElementByName('monto2').value);
ff_getElementByName('total').value=total.toFixed(0);
}

Please Log in or Create an account to join the conversation.

How to show a TOTAL field for a sum fields with dots as thousands separators? 4 weeks 1 day ago #272977

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 10071
  • Karma: 3
  • Thanks: 679
Hi,

please try like this:
function ff_sumacampos_init()
{
setInterval('suma()',500);
} // ff_sumacampos_init

function suma() {
var total=
Number(ff_getElementByName('monto1').value) + 
Number(ff_getElementByName('monto2').value);
ff_getElementByName('total').value=total.toLocaleString('de-DE', {
    minimumFractionDigits: 2,
    maximumFractionDigits: 2
});

}

Let me know the result

Regards,
Tihana

Please Log in or Create an account to join the conversation.

Last edit: Post by tihana.krivic. Reason: missed }

How to show a TOTAL field for a sum fields with dots as thousands separators? 4 weeks 16 hours ago #273087

  • Topic Author
  • carlos.carrasco@live.cl
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • ...
  • Posts: 7
  • Thanks: 0
Hi, thanks,

it's work, I've close } the code and change to my locale 'es-CL' and works ok .
but stil show decimals, example 1000 + 1000 = 2.000,00
I need to show integer number without decimals: 1000 + 1000 = 2.000
I,ve tried some configurations without success

thanks again.

You do not have permissions to access this page.

Please Log in or Create an account to join the conversation.

How to show a TOTAL field for a sum fields with dots as thousands separators? 4 weeks 7 hours ago #273093

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 10071
  • Karma: 3
  • Thanks: 679
Hi,

please try this:
function ff_sumacampos_init()
{
setInterval('suma()',500);
} // ff_sumacampos_init

function suma() {
var total=
Number(ff_getElementByName('monto1').value) + 
Number(ff_getElementByName('monto2').value);
ff_getElementByName('total').value=total.toLocaleString('es-CL');
}

Let me know if this helps

Regards,
Tihana
The following user(s) said Thank You: carlos.carrasco@live.cl

Please Log in or Create an account to join the conversation.

Last edit: Post by tihana.krivic.

How to show a TOTAL field for a sum fields with dots as thousands separators? 3 weeks 6 days ago #273131

  • Topic Author
  • carlos.carrasco@live.cl
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • ...
  • Posts: 7
  • Thanks: 0
works ok!
It was more easy that I was thinking,
thanks!

PD, sorry my english :)

Please Log in or Create an account to join the conversation.

How to show a TOTAL field for a sum fields with dots as thousands separators? 3 weeks 6 days ago #273134

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 10071
  • Karma: 3
  • Thanks: 679
Hi,

super, I am glad I was able to help :D

If you need anything else, feel free to ask

Regards,
Tihana

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.051 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!