Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Why not simply change the date format:
Copy link to clipboard
Copied
Use this:
if (this.getField("RaffleDate").value=="") event.value = "";
else {
// rest of your code goes here
}
Copy link to clipboard
Copied
Also, this is wrong:
event. Value = "";
It needs to be:
event.value = "";
JS is case-sensitive, remember!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now