9 Replies Latest reply on Nov 3, 2017 7:48 AM by mynameisjberg

    How to show a field after another field reaches specific values?

    mynameisjberg Level 1

      I'm creating a form for work and I'm trying to reduce back and forth questions between clients. The form I am creating has the user input their birth date in (Field A). I already used the following script to automatically calculate the age and put it in (Field B):


      event.value = "";

      var dobValue = getField("dob").value;

      if (dobValue!="") {

      var dob = util.scand("mm/dd/yyyy", dobValue);

      var today = new Date();

      // compute age in milliseconds

      var age = today.getTime() - dob.getTime();

      // convert age to years ( millsec in sec * sec in min * min in hrs * hrs in day * days in year)

      // truncate to whole years and adjust for binary floating point error

      event.value = Math.floor( age / (1000 * 60 * 60 * 24 * 365.2425) - 0.005);



      I'm trying to get (Field C) to show after (Field B) reaches every five years at the following values: 20, 25, 30, 35, 40, 45 and every year 50. It is important that the field only shows on the zero/five years, but remain hidden when the value is one through four and six through nine. The every year after 50 shouldn't be hard, but I imagine the other portions might be.


      I'm not sure if this is even possible, but I figured someone might be able to give me a hand.