Questions and discussion about using ProcessMaker: user interface, running cases & functionality

Moderator: amosbatto

#827570
Hi, I need help to fix my function. this is used in number only textbox which is autoformat to "x year/years"
Code: Select all
function formatInYears(FieldID, newVal, oldVal){
  console.log(FieldID); //instead of fieldID, this return new Value of id
 //I want to add suffix FieldID_label to x years (it's mean real data only contains number, but show as x year/years)
}

$('#document').ready(function() {
	//mandatoryPoA();
  	mandatoryConfOthers();
  	informedlabel();
  	$('#durationNDA').setOnchange(formatInYears); //I want to make formatInYears function reusable to another field
});
any advice?
#827608
Use lib: https://igorescobar.github.io/jQuery-Mask-Plugin/docs.html
Step 1: Copy lib jquery.mask.js to: /opt/processmaker/workflow/public_html/assets/js
Step2: Add external libs in dynaform: /assets/js/jquery.mask.js
Step 3: Add script in Dynaform
Code: Select all
$('#test').getControl().mask('#.##0 year/years',  {reverse: true});
$("#btnSave").on("click", function() {
    $('#test').getControl().unmask();
});
$('#' + frames.dyn_uid).setOnSubmit(function () {
    $('#test').getControl().unmask();
});
#827686
Hi,
You can change your code to like this code:
Code: Select all
function formatInYears(FieldID, newVal, oldVal){
  console.log(FieldID); //instead of fieldID, this return new Value of id
 //I want to add suffix FieldID_label to x years (it's mean real data only contains number, but show as x year/years)
}

$('#document').ready(function() {
	//mandatoryPoA();
  	mandatoryConfOthers();
  	informedlabel();
  	$('#durationNDA').setOnchange(function(newValue, oldValue){
		formatInYears(FieldID, newValue, oldValue);
	}); //I want to make formatInYears function reusable to another field
});
https://www.youtube.com/channel/UCYiyz1y8Qf4EZjMXodwH1iw/videos
https://www.linkedin.com/in/pmlearning/
Thanks

hi everybody , please help me to solve this proble[…]

There's no way to do that. The only way to do so i[…]

Hello, If you are using a version of ProcessMak[…]

I really appreciate the work you did. I got to kno[…]