Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Autofill date in another field but with different format

Guest
Sep 18, 2019 Sep 18, 2019

I have a form with dates that have different formats. I wanna be able to autofill all the dates but the problem is that the 1st field where in users will input the date has the typical mm/dd/yyyy format while the other has a Combo format of yyyymmdd. Is there a script that will allow the 2nd field to autofill in its required format?

684
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 18, 2019 Sep 18, 2019

Set the format of the 2nd field to date (Custom) and add the pattern "yyymmdd" in the box that show up. Then in the calculate action, add a custom JavaScript as follows. Change the field name to match your 1st field.

 

event.value = this.getField("firstDateField").value
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 18, 2019 Sep 18, 2019
LATEST
Tried this and an error pops up. "Invalid date/time: please ensure that the date/time exists. Field [date2] should match format yyyymdd"
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines