1 2 Previous Next 15 Replies Latest reply: May 23, 2012 5:00 PM by Aaron Carey RSS

Date Dependency

Jim Crosby

I want to make one date field dependent on another date field in an Issue form.  The user will enter date1 and date2 will be populated automatically as a result of date1.  Autofield will not allow this as it only works with dropdowns and multi-select fields.  Any ideas ?  Thanks in advance !!!!

  • 1. Date Dependency
    Carlos Icaza


    With date fields you will need to do some custom coding.

    If the fields werent date fields, you could have used escalations, because in "Escalation Actions" you can copy the value of any field to other one on the "Workspace/Address Book Fields, but with the limitation that the file on which you will copy needs to be a Character field or a multiline.


    If both fields are date type you only can copy the fileds with a custom script running on a escalation or a trigger on the database.

  • 2. Date Dependency
    Aaron Carey

    You can do this easily with a little JavaScript, what are the field names and what exactly are you trying to do?

  • 3. Date Dependency
    Jim Crosby

    Thanks for this answer, however, I don't want to copy a date.  I want one date to be dependent on another.  In other words, I want to create a rule whereby date2 is arrived at based on the value of date1.


    Does this require custom code or is there a way in FP to do this using Form Designer, autofields, escalations, or some other control mechanism ?


    Thanks !!!!

  • 4. Date Dependency
    Jim Crosby

    The field names are "Release Date" and "Drop Dead Date".  I want the Drop Dead Date to be a result of the Release Date (e.g., the Drop Dead Date is 5 days prior to the Release Date).

  • 5. Date Dependency
    Aaron Carey

    These fields are DATE fields and not DATE TIME correct?

  • 6. Date Dependency
    Jim Crosby

    Well, right now they're Date/Time, but that can be changed to Date only if it will work better that way.  I can make Time another variable somewhere else if it is needed.

  • 7. Date Dependency
    Aaron Carey

    Not a problem, the variables I need for the script are different based on the field type so I wanted to make sure I code it correcly.


    There are a coule ways to accomplish this:

    1. Create a button called "Set Drop Dead Date" that when they click will set the Drop Dead Date
    2. Set a trigger on another field so that when that field is changed it will set the Drop Dead Date


    Which would you prefer?  If you want to set it to trigger on another field what is the field type and name

  • 8. Date Dependency
    Jim Crosby

    Using a trigger will work best I believe.  The field that will be the trigger is a Date/Time field and is named "Release Date".  The field that will be triggered is also a Date/Time field and is called "Drop Dead Date".


    Thanks millions !!!!!

  • 9. Date Dependency
    Aaron Carey

    Not a problem, one last question what version of FP are you on?

  • 10. Date Dependency
    Jim Crosby

    We're on 11.0.3

  • 11. Date Dependency
    Aaron Carey

    Create a Custom HTML field on your form and place it below both the date fields, UNCHECK the Rich Text checkbox and place this code inside of it:


    <script  type="text/javascript">


    function changeReleaseDate(cValue){


    if(cValue.length > 0)


    var myDate = new Date(cValue);

    var dayOfMonth = myDate.getDate();

    var myTime = myDate.toTimeString();


    // Reset myDate to 5 days earlier.

    myDate.setDate(dayOfMonth - 5);


    var month = myDate.getMonth()+1;

    var day = myDate.getDate();

    var year = myDate.getFullYear();

    doc.Drop__bDead__bDate_datetime.value = month + '/' + day + '/' + year;




    var doc = document.regform;


    doc.Release__bDate_datetime.onblur = function() { changeReleaseDate(doc.Release__bDate_datetime.value); };

    doc.Drop__bDead__bDate_datetime.onblur = function() { changeReleaseDate(doc.Release__bDate_datetime.value); };


    //hide calendar image and today check box

    document.getElementById('Release__bDateTODAY').style.display = 'none';

    document.getElementById('Release__bDate_datetimeCal_image').style.display = 'none';

    document.getElementById('Drop__bDead__bDateTODAY').style.display = 'none';

    document.getElementById('Drop__bDead__bDate_datetimeCal_image').style.display = 'none';

    document.getElementById('Drop__bDead__bDateTODAY').style.display = 'none';



  • 12. Date Dependency
    Jim Crosby

    This worked and I have been able to modify it to work with certain other variables.  Thanks !!!!

  • 13. Date Dependency
    Aaron Carey

    Awesome!  Glad I could help.

  • 14. Date Dependency
    Jim Crosby

    Just a note (I am going to report this as an issue with Footprints).... The code works in Preview, but after the form is Published, it no longer works in Preview or production......  Weird.....

1 2 Previous Next