-
Natasha_Davis_natashaI 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:- Date picker with current date as default - fails to update across edits and effectively holds the creation date
- The Form Calculation Widget doesn't have any function along the lines of a today() or now()
- Every other date type widget - same behaviour as 1
- 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:
- 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
- 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...
- 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.
-
ilkkan Channel Marketing SpecialistHi 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:
- In Form Builder, click on the Current Date field.
- Click on the Gear icon and click on Duplicate.
- Go to the Advanced tab and turn on Hide Field.
4. Click on the Add Form Element +menu and Go to Widgets.
5. Search URL and add the Get Form Page Url Widget.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.
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.