Skip to main content
Participating Frequently
June 7, 2024
Answered

Day value from drop down calendar into a text box

  • June 7, 2024
  • 1 reply
  • 1079 views

I am working on a trip request form and I want to  create custom a script that takes the drop down calendar selection and populates the actual day (Monday, Tuesday, Wednesday, etc.)  into a seperate text box. For example, if I dropdown the calendar and select "6/7/2024", a second textbox would generate the actual day of the week. (See the attached form as an example).

 

From there, I would like weekends and holidays to show up in red text. For example, if the date selected falls on a week day or holiday, all text on that row/line will turn red, indicating that a weekend date was selected. Please let me know if this is possible.  

This topic has been closed for replies.
Correct answer PDF Automation Station

For Saturdays and Sundays, enter the following custom format script into the day fields:

if(event.value=="Saturday" || event.value=="Sunday")

{event.target.fillColor=color.red}

else

{event.target.fillColor=color.black}

For holidays, you would have to list all of the holidays in an array in the previous validation script and have the script look for a match.

1 reply

PDF Automation Station
Adobe Expert
June 7, 2024

Enter the following custom validation script into the date fields and change the corresponding day field names:

 

var aray=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
this.getField("DayRow1").value="";
if(event.value)
{this.getField("DayRow1").value=aray[util.scand("m/d/yy", event.value).getDay()]}

 

Participating Frequently
June 7, 2024

Thank you so much, this worked! Now is their a way to make the text for Saturdays, Sundays, and Holidays, turn red?

 

PDF Automation Station
Adobe Expert
June 8, 2024

For Saturdays and Sundays, enter the following custom format script into the day fields:

if(event.value=="Saturday" || event.value=="Sunday")

{event.target.fillColor=color.red}

else

{event.target.fillColor=color.black}

For holidays, you would have to list all of the holidays in an array in the previous validation script and have the script look for a match.