How do i calculate the total work experience ?

Confluence User - 26 Mar, 2020

I have designed a table that consists of 4 fields including the duration of work, now I want to calculate whether the total experience is more than or equal to 5years and if not then display an error message.

forms;datalists

2


27 Mar, 2020
confluenceUser
confluenceUser

If you are using Joget Enterprise or Professional version, use this form element Calculation Field to add two or more fields. 

If you are using Joget Community version, you hv to use Custom HTML and Javascript ( example here ).

27 Mar, 2020
confluenceUser
confluenceUser


Please help with this custom HTML as I have to display the addition of this duration of experience and validator whether it is more than or equal to 5 years.



CODE:

<script language="JavaScript" type="text/javascript">


for (int i = 0; i < rowLength; i++){
$('input[name="exp"]').change( function(){
d1 = $('input[name="exp"]');
var ex =0;
ex = ex + d1;



function calcDate(ex,d1) {
var diff = Math.floor(ex.getTime() + d1.getTime());

var years = Math.floor(diff/31536000000);
var months= Math.floor((diff%31536000000)/2628000000);
var days = Math.floor(((diff%31536000000)%2628000000)/86400000);
var msg = years + " years ";
msg += months + " months ";
msg += days + " days " ;

return msg
}
}
a = calcDate(ex,d1)
$('input[name=field8]').val(a);
});

</script>


RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print