1850
Views
11
Comments
Solved
Is there a way to format a number in input field?
Question

I have an input field and I'd like to format the number written by the end user with two decimal places and setting a group separator with a space. I cannot use the formatdecimal built-in function as it does not work in the input field. Customs Masks do not work in this environment - it did not install at all. Using input masks trigger some unusual events that are not desired. Any hints? Thanks.


2025-08-08 18-54-29
Nuno Maurício
Staff
Solution

Jorge Almeida wrote:

It is not working. It stays in this way all the time... 

Hi Jorge, 


Do you have multiple catalog in your database?

If you have, you cannot install via service studio.

Please, try to install the Custom Masks component via Service Center.


Let me know if it solved your issue.

Thanks.


2016-06-29 09-25-29
Thomas Robinson

Hi Jorge,

What is your platform version?


Regards,
Thomas

2016-07-12 16-07-47
Jorge Almeida

VERSION 9.1.300.0

2016-06-29 09-25-29
Thomas Robinson

Jorge,

Supposely, the CustomMasks component should work on that version. Why can't you use it in your environment?

Regards,
Thomas

2016-07-12 16-07-47
Jorge Almeida

It is not working. It stays in this way all the time... 

2025-08-08 18-54-29
Nuno Maurício
Staff
Solution

Jorge Almeida wrote:

It is not working. It stays in this way all the time... 

Hi Jorge, 


Do you have multiple catalog in your database?

If you have, you cannot install via service studio.

Please, try to install the Custom Masks component via Service Center.


Let me know if it solved your issue.

Thanks.


2025-04-22 05-54-18
Shashi Kant Shukla

Hi Jorge,

we can use jquery like below:

SyntaxEditor Code Snippet

function formatCurrency(total) {
    var neg = false;
    if(total < 0) {
        neg = true;
        total = Math.abs(total);
    }
    return (neg ? "-$" : '$') + parseFloat(total, 10).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,").toString();
}

function PriceOnBlur(obj){
 debugger;
 $(obj).val(formatCurrency($(obj).val()))
}


Regards

SK

2016-07-12 16-07-47
Jorge Almeida

thanks. I will need a jquery script to allow numbers and dot...

2025-04-22 05-54-18
Shashi Kant Shukla

Jorge,

I have implemented same feature using provided jquery script.

you can use it.

Regards

SK


2016-07-12 16-07-47
Jorge Almeida

Dear Nuno


It worked uploading from the service center! Thanks for the tip. 

2025-08-08 18-54-29
Nuno Maurício
Staff

You're welcome, Jorge. :)

Best regards.

2018-03-05 03-47-24
Anggun Nurani

what about input format number like XX – XXX – XXX – X – XXX – XXX in mobile?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.