Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
Hi,
I have managed to make it, as the time picker is text field, but I believe code could be further optimized.
<script type="text/javascript">
$(document).click(function(){
var d1 = "godz_wjazdu_na_platf";
var d2 = "godz_wyj_z_platf";
var fieldId = "czas_pobytu";
//get value from parent form
var d3 = $('[name='+d1+']:enabled').val();
var d4 = $('[name='+d2+']:enabled').val();
// calculate number of minutes for first field
var d5 = d3.substring(0, 2);
var d6 = d3.substring(3, 5);
var d7 = ((d5 * 60) + (d6 * 1));
//calculate number of minutes for second field
var d8 = d4.substring(0, 2);
var d9 = d4.substring(3, 5);
var d10 = ((d8 * 60) + (d9 * 1)) ;
//final calculation (number of minutes)
var d11= (d10 - d7) ;
diff = d11; // ms per day
//store the value to a field
$('[name='+fieldId+']:enabled').val(diff);
});
</script>
great - thanks for posting the solution! I am going to need the same function shortly.
Where we can write this script ?
You add a customHTML field to your form and then put the script in there. :)
Thank you for the response. I am new at the joget, could you please explain me in detail where i have to put this script ?? which validator i have to use for this script ?
What if I want to make sum of d1 and d2, i tried using my own coding but it didn't work. Anyone could help me?
I want the coding for storing the value to a field like above but without the val(diff)..
Hi Experts,
I want to calculate duration between two times using custom HTML.
As a input I'm using Time Picker. I have two input fields field1 and field2
As a result in field field_result I would like to get number of minutes.
Unfortunately no luck, any help would be really appreciated!