Javascript functions - replacement of calworkdays

Hi,
I have a problem regarding the calculation of a calworkdays function for two dates on a user form. We are not using SAIL at the moment, so until we upgrade, can you please give us a workaround solution by using javascript functions?
I have tried using the following code (for an on-change event of the date input fields):

if (window.FormAPI.getValue("date1").id !=""){
if (window.FormAPI.getValue("number40").id=="")
{
window.FormAPI.setValue('number40',"");
$('input:submit.submitButton')[0].click();
}
else
{
window.FormAPI.setValue('number40',"");
$('input:submit.submitButton')[1].click();
}
}

What this code does is whenever the user changes the values of the date input forms, the javascript function submits a hidden button and reloads the form (as a chained action) and in the output of the form, the calculation of calworkdays is done, so that when the form reloads, that value will be shown in the '...

OriginalPostID-242887

  Discussion posts and replies are publicly visible