Edit Submission: Update Current Date

  • Profile Image
    Natasha_Davis_natasha
    Asked on February 6, 2023 at 7:20 PM

    I have created an internal company form that is edited multiple times as "jobs" flow through the system over days of weeks. Central to this is being able to get todays date, not the form creation date but the current date equivalent to today() or now() in Excel.
    I have tried:

    1. Date picker with current date as default - fails to update across edits and effectively holds the creation date
    2. The Form Calculation Widget doesn't have any function along the lines of a today() or now()
    3. Every other date type widget - same behaviour as 1
    4. The Get visitor location which does capture the current time, combined with a substring widget to get left 10 characters, but the substring isn't triggered automatically. I also tried using an intermediary field to pull the location into a clean string format then into the substring - still doesn't trigger.

    I really need the current date in the form to drive certain behaviour but I even tried building my logic around the submissions table by:

    1. Using the Advanced formula editor to generate a date from the visitor location string, which works and I can effectively get the last edited date in the submissions table, but
    2. If I try to apply any logic to that date such as a switch on a status field then return TODAY(), vs a datepicker field vs DATEADD(LastEdit, 2, "days") I get inconsistent formatting. eg "2/6/2023" vs "2023-02-06", So...
    3. I tried using the DATETIME_FORMAT() and instead of getting "Tue 6 Feb" type outputs I got "2 6 2"... I literally used copy and paste from the JotForm articles and it fails.

    Coming from a coding background, this is intensely frustrating trying for hours to do something that would take me seconds in code or Excel!

    Please lodge a change request to add Today() returning a date value and Now() returning a datetime value to the Form Calculation Widget.

  • Profile Image
    ilkkan Channel Marketing Specialist
    Replied on February 7, 2023 at 2:15 AM

    Hi Natasha,

    Thanks for reaching out to Jotform Support. Unfortunately, it's not possible to automatically update the previously selected date to the current date when editing the form. Because the field was already populated and the previous data has been saved already. Even if the Date Picker field is set to display the current date, the field's value when the form was initially submitted will still be the one used.

    As a workaround, you can use a hidden date field. If you create a hidden date field for the edit date, when the user goes to edit the submission, the first submission date can be hidden, and the edit date field can be shown as today's date. Let's do it:

    1. In Form Builder, click on the Current Date field.
    2. Click on the Gear icon and click on Duplicate.
    3. Go to the Advanced tab and turn on Hide Field.

    1675753722 63e1f8fadbe9a  Screenshot 10

    4. Click on the Add Form Element +menu and Go to Widgets.
    5. Search URL and add the Get Form Page Url Widget.

    1675753830 63e1f96665395  Screenshot 21

    6. Click on Settings in the orange navigation bar at the top of the screen.
    7. Go to Conditions, click on Add a new condition and select Show/Hide Field.
    IF: Get Page URL
    STATE: Contains
    VALUE: edit
    DO: Show
    FIELD: Current Date (edit)

    8. Click on Save.

    1675754081 63e1fa617aa31  Screenshot 32

    We also have a guide about Showing or Hiding Fields on Edit URL that you can check out.

    Give it a try and let us know if you have any other questions.