Questions and discussion about using ProcessMaker: user interface, running cases & functionality
By azirol
#823210
Hi, i am new to processmaker. hopefully someone can help me to make total sub in text are outside from the grid.
this is the example i made to the dynaform unfortunately its not wotking. i've also attached the dynaform. please help.

#gridVar008 is the grid & textVar211 is subtotal text area.

Thanks

//Change backcolor
document.getElementById("form[approveBtn]").setAttribute('style','background-color:#228B22;width:150px;border:none;color:white;');

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

}

var sum =0;
for (var i=1;i<=$("#gridVar008").getNumberRows();i++){
if($("#gridVar008").getValue(i,2) == "1"){
$("#gridVar008").setValue((parseFloat($("#gridVar008").getValue(i,3))),i,4);
}
else{
$("#gridVar008").setValue(0,i,4);
}
sum=sum+$("#gridVar008").getValue(i,4);
}

$("#textVar211").setValue(parseFloat(sum));

// Approval comments hide/show
var approval = $('#approval').getValue();
if(approval=='2'){
$('#subtitle0000000003').show();
$('#approverComments').show();

}else{
$('#subtitle0000000003').hide();
$('#approverComments').hide();

}
Attachments
(121.88 KiB) Downloaded 269 times
By azirol
#823444
Hi Ashkufaraz,


could you help me to put 2 decimal on the amount text area with commas.
for example 1,200.00 or 100.00
i tried multiple way but returning the code error.. :(


Thanks
ashkufaraz wrote:With this code you can do it
Code: Select all
$(document).on("change","[id*='form[gridVar008][']",function(){
 
 $("#textVar211").setValue($("#sum-gridVar008-text0000000187").val())
 
});
Attachments
(16.96 KiB) Downloaded 267 times
#823456
Try this JavaScript:
Code: Select all
$(document).on("change","[id*='form[gridVar008][']",function() {
   var total = $("#sum-gridVar008-text0000000187").val();
   total = parseFloat(Math.round(total * 100) / 100).toFixed(2);
   $("#textVar211").setValue(total); 
});
By azirol
#823460
Hi,

I've test the code as below:

$(document).on("change","[id*='form[Expenses][']",function(){
var total = $("#sum-Expenses-total").val();
total = parseFloat(Math.round(total * 100) / 100).toFixed(2);
$("#textVar002").setValue($("#sum-Expenses-total").val())

});

unfortunately, it only show 1 number on the Total field.
i need to set if i put 1,200 or 1200 on the Amount field, the Total field with display 1,200.00.

Thanks
Attachments
(18.71 KiB) Downloaded 261 times
Screenshot (34).png
Screenshot (34).png (52.27 KiB) Viewed 5118 times
#823462
You didn't copy my example correctly. Your code should be:
Code: Select all
$(document).on("change","[id*='form[Expenses][']",function(){
    var total = $("#sum-Expenses-total").val();
    total = parseFloat(Math.round(total * 100) / 100).toFixed(2); 
    $("#textVar002").setValue(total);
});
#823483
If you really want commas in your numbers, then you can adapt this code:
https://www.pmusers.com/index.php/Europ ... )_in_grids

Change the code from:
Code: Select all
$("[id='form["+gridId+"]["+i+"][X]']")   .maskNumber({decimal: ',', thousands: '.'});
To:
Code: Select all
$("[id='form["+gridId+"]["+i+"][X]']")   .maskNumber({decimal: '.', thousands: ','});
Where X is the ID of the grid field.

Frankly, it is easier to train your users to not use commas in numbers, but if you really want commas, this is what you have to do.

Being the best in the started business is the obje[…]

Winzo is a popular and unique game on the mobile p[…]

Cannot create process using templets

Real details. The problem was solved by effect!

However, it is essential to use it responsibly and[…]