Skip to main content
Participant
October 8, 2025
Question

Issue with a date field.

  • October 8, 2025
  • 2 replies
  • 100 views

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. 

2 replies

try67
Community Expert
Community Expert
October 8, 2025

Use this:

 

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

try67
Community Expert
Community Expert
October 8, 2025

Also, this is wrong:

event. Value = "";

It needs to be:

event.value = "";

 

JS is case-sensitive, remember!

PDF Automation Station
Community Expert
Community Expert
October 8, 2025

Why not simply change the date format: