How to pre-fill a date field based on an another field's input?

  • kurtarild
    Asked on May 20, 2017 at 5:45 AM

    I have a booking form

    https://form.jotformeu.com/71276760680360

     

    Depending on what kind of tour you chosse the time of day and minute shall be pre - filled, example,, if you choose Fishing trip with Arctic Princess, From Time: 10:00 and to Time: 13:00

    If you choose Whalesafari, time shall be 09:30 - 14:30 and so on....

     

     

    Kurt Arild

  • AIDAN
    Replied on May 20, 2017 at 11:19 AM

    That should be possible by following our guide on how to insert text/calculation into a field using conditional logic here: https://www.jotform.com/help/268-Conditional-Logic-Inserts-Text-Calculation-Into-A-Field

    Furthermore, a general guide on creating smart forms using conditional logic can be found here: https://www.jotform.com/help/57-Smart-Forms-Using-Conditional-Logic

    I hope this helps. If you need further assistance please let us know. Thank you.

  • aubreybourke
    Replied on May 20, 2017 at 12:49 PM

    Your form is very complicated. I would suggest breaking down the date and time fields. Separating your date calculations from your time calculations would make the conditional logic a little easier.

     

  • aubreybourke
    Replied on May 20, 2017 at 1:53 PM

    I cloned your form. But, I cant seem to get it to work. I can see you are showing a field instead of update/calculating as a work around.

    Does anyone know if the update/calculate function supports the date/time or even just time fields?

     

  • aubreybourke
    Replied on May 21, 2017 at 6:48 AM

    I managed to retrieve your form values and insert them into a new text field.

    https://form.jotformeu.com/71394228282358

    Maybe you should alter the surveying values? For example instead of a single value like 1800, you could change the surveying value to "9:30-14:30"

    1. Drag and drop a text field.

    How to pre fill a date field based on an another fields input? Image 1 Screenshot 50

    2. Change the radio button surveying values to be the full duration of a trip

    How to pre fill a date field based on an another fields input? Image 2 Screenshot 61

    3. Update/Calculate a field. And after selecting the field click on the field once (so that it says A-Z). This converts the variable into a string. This is important because a number wont work well for a from/to time value.

    How to pre fill a date field based on an another fields input? Image 3 Screenshot 72

     

     4. Preview! And if this is what you want, then you need to change the other surveying values as well.

    How to pre fill a date field based on an another fields input? Image 4 Screenshot 83