Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
5 replies
Subscribers
7 subscribers
Views
2796 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
User Interface
Javascript functions - replacement of calworkdays
bojanb
over 8 years ago
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
Parents
0
bojanb
over 8 years ago
We have previously tried calling this function when loading the page:
var dateID = 'date2';
var dateID2 ='date1';
var AbsenceCA = 'dropdown21';
$('#date_date_' + dateID2 + '_valueDateSingle_fd_component_' + window.FormDesigner.runtimeNamespace + dateID2 +'_').trigger('change');
$('#date_date_' + dateID + '_valueDateSingle_fd_component_' + window.FormDesigner.runtimeNamespace + dateID +'_').trigger('change');
var todate = window.FormAPI.getValue("To_date_value").id;
window.FormAPI.setValue('date2',todate);
var fromdate = window.FormAPI.getValue("From_date_value").id;
window.FormAPI.setValue('date1',fromdate);
But when loading the page, the process goes into a long loop (reloading the page over and over...because the onload function triggers the onchange event of the date input fields...
Initially, I want the values to be empty so that the user must input them (so that there are no mistakes when filling the form).
Do you have any other idea or advice?
Thank you again... BR
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
bojanb
over 8 years ago
We have previously tried calling this function when loading the page:
var dateID = 'date2';
var dateID2 ='date1';
var AbsenceCA = 'dropdown21';
$('#date_date_' + dateID2 + '_valueDateSingle_fd_component_' + window.FormDesigner.runtimeNamespace + dateID2 +'_').trigger('change');
$('#date_date_' + dateID + '_valueDateSingle_fd_component_' + window.FormDesigner.runtimeNamespace + dateID +'_').trigger('change');
var todate = window.FormAPI.getValue("To_date_value").id;
window.FormAPI.setValue('date2',todate);
var fromdate = window.FormAPI.getValue("From_date_value").id;
window.FormAPI.setValue('date1',fromdate);
But when loading the page, the process goes into a long loop (reloading the page over and over...because the onload function triggers the onchange event of the date input fields...
Initially, I want the values to be empty so that the user must input them (so that there are no mistakes when filling the form).
Do you have any other idea or advice?
Thank you again... BR
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data