Page 2 of 2

Re: Currency Format in Textbox

Posted: Wed Jul 18, 2018 7:43 am
by NAlvarado
Thanks!

Re: Currency Format in Textbox

Posted: Mon Jul 30, 2018 3:51 am
by PipSqueak
amosbatto wrote: Tue Jun 06, 2017 7:43 pm
endangkusmayadi wrote:I have problem when it applied to textbox in grid, is it possible using jquery.masknumber.js to format number in grid??
Endang, you can use this JavaScript code to set the thousands separator in grid fields:
Code: Select all
var gridId = "orderList"; //set to ID of grid
var fieldId = "amount"; //set to ID of text field inside grid

//set the thousands separator in all existing rows when the DynaForm loads:
var nRows = $("#"+gridId).getNumberRows()
for (var i = 1; i <= nRows; i++) {
  $("[id='form["+gridId+"]["+i+"]["+fieldId+"]']").maskNumber({decimal: ',', thousands: '.'});
}

//set the thousands separator in newly added rows:
$("#"+gridId).onAddRow(function(aNewRow, oGrid, rowIndex) {
  $("[id='form["+gridId+"]["+rowIndex+"]["+fieldId+"]']").maskNumber({decimal: ',', thousands: '.'});
});
Hi Amos,

How do I make the sum function work with the masked numbers in a grid?

Thanks

Re: Currency Format in Textbox

Posted: Mon Jun 24, 2019 4:39 pm
by Bosatzu
zainab wrote: Tue Apr 04, 2017 2:59 am Hello,

Could you please export your dynaform's JSON code, in order to better debug your issue. Also when previewing the dynaform, use your browser's Developer tool and open the console log, check what you find in the console log, this might give you an idea what is wrong with your javascript if any. Also kindly attach the screenshot here if possible.

Is there any other javascript in your dynaform? Check if that is causing any error.

Looking forward to your response.

Best Regards,
Zainab Sabunwala
Hi! can you help me out? i have this problem: viewtopic.php?f=41&t=736854&p=825048#p825048

Re: Currency Format in Textbox

Posted: Mon Jun 24, 2019 5:16 pm
by Bosatzu
amosbatto wrote: Tue Apr 04, 2017 2:10 pm Are you using a regular expression in the validate property to guarantee that it is a floating point value? If so, then clear your validate property.
Hi Amos! Could you help me out here please? : viewtopic.php?f=41&t=736854

Re: Currency Format in Textbox

Posted: Mon Dec 04, 2023 10:21 am
by Acroporax
amosbatto wrote: Wed Apr 05, 2017 8:28 pm The problem is that you are using a variable for your textbox which is float type. You need to change your variable type to string.
You can create a hidden field that uses the float variable. Then use JavaScript to copy between the two fields. For example, if the visible field has an ID of myString and the hidden field has an ID of myFloat:
Code: Select all
$("#myString").setOnchange( function(newVal, oldVal) {
  newVal = newVal.replace(",", "");
  $("#myFloat").setValue(newVal);
});
//copy value from hidden field to visible field when form loads:
var val = $("#myFloat").getValue();
val = val.replace(/\B(?=(?=\d*\.)(\d{3})+(?!\d))/g, '_'); 
$("#myString").setValue(val); 
When i write to mystring 1250000.00 then i get error

Image