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
3 replies
Subscribers
8 subscribers
Views
1573 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
User Interface
Hello All, I am on appian 7.2. I want to set date field on form
achaugule
over 10 years ago
Hello All,
I am on appian 7.2.
I want to set date field on form at run time.Use case is as follows,The use case ias follows,there are two date fields on form. I want to add fixed number of days to one of date field and calculation of this date and days to be shown on second date field.
I am able to do using ajax call and calling appian caladddays function.
But I am not able to set result in second date field.
Following is js code
importScript('/plugins/servlet/FormsExt.js');
var a=document.getElementsByName("dtEffectiveDate")[0].value;
FormAPI.evaluateServerSideExpression(function(fn){
alert(fn);
var c=new Date();
alert(c);
c=fn;
alert(c);
document.getElementsByName("dtCalculatedDate")[0].value=c;
c= document.getElementsByName("dtCalculatedDate")[0].value;
//alert(c);
}, ["addWorkingDaystoDate","2",a]);
Here I am getting correct value in variable 'c' but I am not able to set it for date fi...
OriginalPostID-103385
OriginalPostID-103385
Discussion posts and replies are publicly visible
Parents
0
Eduardo Fuentes
Appian Employee
over 10 years ago
Once you have the new date you want to set, here's how you can set it:
function setDateTimeField(dateFieldID, newDate){
$('#date_date_'+dateFieldID+'_valueDateSingle_fd_component_'+window.FormDesigner.runtimeNamespace+dateFieldID+'_').val(newDate);
$('#date_date_'+dateFieldID+'_valueDateSingle_fd_component_'+window.FormDesigner.runtimeNamespace+dateFieldID+'_').trigger('change');
}
The only thing I am doing here is retrieving the input field used for the date and setting its value with the val() function part of the JQuery API. In addition I am triggering the change event in order to notify the component that it has a new value and avoid validation errors if the field is required.
Here's a sample application that changes the date of a field
forum.appian.com/.../9614
The process model is under Process Models – Forum and is called Date with JS which comes with a JS file called dateUtilities located in Default Community > Temporary Documents Knowledge Center > Temporary Documents >JS libraries.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
Eduardo Fuentes
Appian Employee
over 10 years ago
Once you have the new date you want to set, here's how you can set it:
function setDateTimeField(dateFieldID, newDate){
$('#date_date_'+dateFieldID+'_valueDateSingle_fd_component_'+window.FormDesigner.runtimeNamespace+dateFieldID+'_').val(newDate);
$('#date_date_'+dateFieldID+'_valueDateSingle_fd_component_'+window.FormDesigner.runtimeNamespace+dateFieldID+'_').trigger('change');
}
The only thing I am doing here is retrieving the input field used for the date and setting its value with the val() function part of the JQuery API. In addition I am triggering the change event in order to notify the component that it has a new value and avoid validation errors if the field is required.
Here's a sample application that changes the date of a field
forum.appian.com/.../9614
The process model is under Process Models – Forum and is called Date with JS which comes with a JS file called dateUtilities located in Default Community > Temporary Documents Knowledge Center > Temporary Documents >JS libraries.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data