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

Issue with a date field.

Community Beginner ,
Oct 08, 2025 Oct 08, 2025

I have a date field on my form, called RaffleDate. It is formated as d/m/yyyy. When I open the form the box is blank as I would expect.

 

I wanted the textbox to display the datevas dddd dd mmmm yyyy

var rawDate = util.scand("mm/dd/yyyy", this.getField("RaffleDate").value); if (rawDate != null) { var dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; var formatted = dayNames[rawDate.getDay()] + " " + ("0" + rawDate.getDate()).slice(-2) + " " + monthNames[rawDate.getMonth()] + " " + rawDate.getFullYear(); event.value = formatted; } else { event. Value = ""; }

. So I have the code below.

My issue is, when i open the pdf RaffleDate is populated with todays date. 

TOPICS
Create PDFs , JavaScript
139
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 ,
Oct 08, 2025 Oct 08, 2025

Why not simply change the date format:

PDFAutomationStation_0-1759944300732.png

 

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 ,
Oct 08, 2025 Oct 08, 2025

Use this:

 

if (this.getField("RaffleDate").value=="") event.value = "";
else {
// rest of your code goes here
}

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 ,
Oct 08, 2025 Oct 08, 2025
LATEST

Also, this is wrong:

event. Value = "";

It needs to be:

event.value = "";

 

JS is case-sensitive, remember!

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