Questions and discussion about using ProcessMaker: user interface, running cases & functionality
By ptmi1047
#786102
Hi All,

I have textbox with variable type number, and I need to change the value from the textbox (ex. 2000000) to currency format (2.000.000,00) when typing the value in textbox like in grid function using mask.
Is there any function that I can use for it? Or can we use javascript for textbox?

Thanks.
By ptmi1047
#786126
Hi Amosbatto,

I put the jquery mask plugin in form - Javascript, with format --> $("#form\\[txtNetSalesVal\\]").mask("999,999,999").
I tried to input the amount, it will have 9 fixed digits based on the format (ex. 100,000,000). It has problem if I input amount with < 9 digits (ex. 2,000,000).
How to make it into dynamic digit when typing the amount.


Thanks.
By cmeier
#786352
Hi,

I followed the instructions on the wiki, and I can't seem to get it to work.

I pasted the code in jquery.masknumber.js directly into the form's javascript just to test it out. Then I used this line of code:

$("#form\\[numProvider\\]").maskNumber();

The dynaform doesn't load.

also tried:

$("#numProvider").maskNumber();

Doesn't work either.


Can i get some help? Thank you!
User avatar
By amosbatto
#786466
cmeier,
First check whether you can access http://{example.com}/jquery.masknumber.js by entering that address in your web browser (replacing {example.com} with your domain name or IP address).

Also make sure that that URL is in your "external libs" property of the DynaForm. Then, check whether the ID of your textbox is spelled as "numProvider".
Remember that the ID is case sensitive. To verify, stick this JavaScript code in your DynaForm:
alert($("#numProvider"));
When you load the DynaForm a message box should appear saying "object".
By Kozure
#789793
Hello forum,

the currency field is working with the proposed jquery solution ... but how to use this in a Gateway Condition?

if invoiceAmount <= 5000 then ...
if invoiceAmount > 5000 then ...

Currency in european format using the jquery solution e.g. 50.000 (fiftythousand) ist internally handled like 50, but 500 is 500 so a workaround like * 1000 is not possible, using decimal separator e.g. 50.000,00 makes it even more complex.

Is there another solution than use 2 fields, one for nice formated currency and a second one with unformated value for conditions?

invoiceAmountFrontend 50.000 (formated withe jquery)
invoiceAmount 50000 (automatically filled unmasked if user enters the value in the above dynaform field)

I think this is a common request in many workflows having country specific layout of currency fields and use this fields for the workflow logic.

Thanks,

Kozure
User avatar
By amosbatto
#789807
ProcessMaker uses standard PHP to evaluate conditions and that is not going to change, so you are going to have to use . for the decimal separator.

My suggestion is to create a trigger before routing which places an English-style value in a second variable which you can use in your condition:
Code: Select all
@@invoiceAmountEn = str_replace('.', '', @@invoiceAmount); 
@@invoiceAmountEn = str_replace(',', '.', @@invoiceAmountEn); 
Then in your condition use:
@#invoiceAmountEn > 5000
@#invoiceAmountEn <= 5000
By lawrencelcy
#790093
Hi, I have follow step in http://wiki.processmaker.com/3.0/Adding ... rical_Mask given.

However I still facing issue where by the screen seem continue to render. here is my step

1. I copy the file into /workflow/public_html/jquery.masknumber.js
2. I make sure the it able to download from http://127.0.0.1:81/jquery.masknumber.js
3. I enter the tested URL in to enternal libs
extlib.PNG
Step 3 cutscreen
extlib.PNG (13.99 KiB) Viewed 52001 times
4. I make sure I copy the Dynaform field ID in the javascript as below
$("#SE_QuotedAmtRM").getControl().maskNumber();

5. The SE_QuotedAmtRM has a float variable type.
6. then the Processmaker screen is keep loading. but when i right click and view frame source I can see the page is complete load. as snap short below
Code: Select all
<script type='text/javascript'>var sysLang = 'en';
var isRTL = false;
var pathRTLCss = '/lib/pmdynaform/build/css/PMDynaform-rtl.css';
var delIndex = 0;
var jsonData = {"name":"Quotation Detail","description":"","items":[{"type":"form","variable":"","var_uid":"","dataType":"","id":"90789794958c75fab786d32023350665","name":"Quotation Detail","description":"","mode":"edit","script":{"type":"js","code":"$(\"#SE_QuotedAmtRM\").getControl().maskNumber();"},"language":"en","externalLibs":"http:\/\/127.0.0.1:81\/jquery.masknumber.js","printable":false,"items":[[{"type":"subtitle","id":"subtitle0000000001","label":"Quotation Detail","colSpan":12}],.......... 
I'm not sure what step I miss, please advice.
By zainab
#790094
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
By lawrencelcy
#790102
Hi Zainab,

thank for your pointing. I found out the root cause of the problem. it was mistake that I made during copy and paste. however, I facing with difference issue. where by the amount fields said an invalid format to be store as float like screen below:-
Amount fields.png
Amount fields.png (18.53 KiB) Viewed 51984 times
what could be the solution where by I want to store 158730.16 in the DB and mask it 158,730.16 on the display?

Thanks in advance.
User avatar
By amosbatto
#790118
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.
User avatar
By amosbatto
#790160
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); 
By endangkusmayadi
#792293
Dear All,

I have problem when it applied to textbox in grid, is it possible using jquery.masknumber.js to format number in grid??
currently, if i applied to textbox, it's no problem, but when i use it on textbox in grid, nothing happen to the textbox.

Please help.
Here is my script (Note: the textbox is in the column no. 4 in the grid, the id name is "namount")
Code: Select all
var oGrid = $('#grdcomments'); //set to the ID of the grid

function roundToFixed(_float, _digits){
  var rounder = Math.pow(10, _digits);
  return (Math.round(_float * rounder) / rounder).toFixed(_digits);
}

$("form").setOnchange(function(field, newVal, oldVal) {
  var totalRows = $("#grdsrr").getNumberRows();
  for (var i = 1; i <= totalRows; i++) {
    nunitprice   = parseFloat($("#grdsrr").getValue(i, 2));
    nqty = parseFloat($("#grdsrr").getValue(i, 3));
    namount = nunitprice * nqty;

    //make sure the user entered valid values:
    if (isNaN(namount)) { 
      namount = '';
    }
    else { 
      namount = roundToFixed(namount, 2);
    }  
    $("#grdsrr").setValue(namount, i, 4);
    $("#grdsrr").getControl(i, 4).maskNumber({decimal: ',', thousands: '.'}); //Here the script to format number in grid
  }  
});
Thank you and Best Regards,

Endang Kusmayadi
User avatar
By amosbatto
#793120
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: '.'});
});
By sofiathefake
#813069
Dear all,
I made the Currency format for my text field. However, I cannot parse the string got from that text field to floating number.
Can anyone help me?
Thanks in advance.
User avatar
By amosbatto
#813084
sofiathefake wrote:I made the Currency format for my text field. However, I cannot parse the string got from that text field to floating number.
Can anyone help me?
First of all, are you using a BPMN process (which is only found in PM 3) or a classic process (from PM 2, but can be imported in PM 3)?

What do you mean by "Currency format"? Can you give examples of the values in the field?
By sofiathefake
#813088
amosbatto wrote:
sofiathefake wrote:I made the Currency format for my text field. However, I cannot parse the string got from that text field to floating number.
Can anyone help me?
First of all, are you using a BPMN process (which is only found in PM 3) or a classic process (from PM 2, but can be imported in PM 3)?

What do you mean by "Currency format"? Can you give examples of the values in the field?
Hi, it worked :D
But I have a trouble on passing the value of a variable of a text field from a form to other form :(
User avatar
By amosbatto
#813132
sofiathefake wrote:
amosbatto wrote:
sofiathefake wrote:
But I have a trouble on passing the value of a variable of a text field from a form to other form :(
If you are using a BPMN process, you need to make sure that you are using the same variable for both fields in the different Dynaforms.
If the two fields have different variables, then create a trigger with this code to transfer the value to the second variable:
Code: Select all
@@field2 = @@field1; 
Set this trigger to execute before the second Dynaform.

If using a classic process, then make sure that the two fields have the same field names. Remember that field names are case sensitive.
User avatar
By amosbatto
#813204
destiny26 wrote:Formatting (eg 100,000,000) Problems if entering with <9 digits (eg .2,000,000)
How to make a dynamic number when typing an amount.
Do you want to automatically insert commas in the number? For that you need to import the masks library as explained in the previous posts.
By NAlvarado
#814735
I have read through this and am trying to follow it. Do both jquery.maskedinput.min.js and jquery.masknumber.js need to be placed in the public_html for this to work (looking at just the comma separator)? I asked the DBA to place jquery.masknumber.js only and this did not work. I have now asked him to place jquery.masknumber.min.js as well and am waiting on his reply. My variable is also of type string and library jquery.masknumber.js is referenced in external libs. Thanks for the help.
User avatar
By amosbatto
#814740
You can use either jquery.masknumber.js or jquery.masknumber.min.js. The jquery.masknumber.min.js file is minimized, which means that it will download a little faster and be loaded a few milliseconds faster. The file is so small that it shouldn't matter which you use.

If you can't get it to work by loading an external file, then simply cut and paste the code into the JavaScript for your Dynaform.
User avatar
By amosbatto
#814853
If the number will always be negative, you can use this:
Code: Select all
$("#amount").getControl().mask("-99.99");
If the number might sometimes be negative, you can use this:
Code: Select all
$.mask.definitions['~'] = '[+- ]';
$("#amount").getControl().mask("~99.99");
The problem, is that you either have to insert a plus, minus or space as the first character. The mask library doesn't allow for a character which might not exist.

Another solution is to use a regular expression, which is more flexible, but doesn't guide the user like masks.
By NAlvarado
#815195
I have a formatted number as 12,345.67 (string variable) but for the routing rule I want it to show as a number of 12000
I placed a trigger in the before routing of the process as the following but the evaluation fails when routing. The variable totalNoFormat is an Integer and the variable totalAmount is a String. Am I missing something in the trigger?

@@totalNoFormat = round(str_replace(",", "", @@totalAmount),0);

The routing rule itself has @@totalNoFormat <= 10000 for Option 1 and @@totalNoFormat > 10000 for Option 2
User avatar
By amosbatto
#815204
Your trigger needs to be this:
Code: Select all
@%totalNoFormat = round(((int) str_replace(',', '', @@totalAmount))/1000, 0)*1000;
Then your routing rule conditions should be @%totalNoFormat <= 10000 for Option 1 and @%totalNoFormat > 10000 for Option 2.

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]