I created an external javaScript. We want to allow a person to enter a date in

I created an external javaScript. We want to allow a person to enter a date in one field and then automatically adjust the date 20 days before for another date. It seems window.FormAPI.setValue("datetime2", myDate); will not work for an Appian date field. I can get it to work for a text field. I looked at limited documentation and could not find an answer. I want to know if this is possible or try to get the user to accept chaining two tasks that will subtract the 20 days to it.

...

OriginalPostID-115554

OriginalPostID-115554

  Discussion posts and replies are publicly visible

Parents
  • This can be easily achieved when using SAIL which I recommend as the best practice but based on your post I think you're not using SAIL yet in which case you're right this feature is not available as part of the Forms API itself but you can definitely update the value using JQuery.

    This function does that:

    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');
    }

    You an find an example at 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
Reply
  • This can be easily achieved when using SAIL which I recommend as the best practice but based on your post I think you're not using SAIL yet in which case you're right this feature is not available as part of the Forms API itself but you can definitely update the value using JQuery.

    This function does that:

    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');
    }

    You an find an example at 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
Children
No Data