0 Replies Latest reply on Feb 10, 2012 12:57 PM by MelissaZoller

    How to auto-populate dates in a calendar based on radio buttons?

    MelissaZoller

      Hi,

       

      I'm trying to create an availability form that is submitted on a monthly basis. What I'd like is to have a radio button the user could click to indicate what day the first of the month falls on (Monday through Sunday), and have fields auto-populate with the remainder of the dates on the calendar. As it stands right now, I've got the radio buttons and the text fields, but I'm running into serious issues getting the text fields to auto-fill based on the selected radio button.

       

      I've labelled the radio button group "First Day of Month" and the individual values are "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday" and "Start". The "Start" button is hidden but is checked by default.

       

      My text fields are even simpler: "Monday 1" "Monday 2" "Monday 3" "Monday 4" and "Monday 5" (and then, obviously, repeated for each day of the week.

       

      I am horrible at scripting, so I think that might be where I'm running into issues. What I'd like to put is something like this (only, you know, functional, and for each days' text value):

       

      For "Monday 1"

      if "First Day of Month.value" = "Monday", "Monday 1.value" ="1"

      else "Monday 1.value" = ""

       

      For "Wednesday 3"

      if "First Day of Month.value" = "Sunday", "Wednesday 3.value" = "11"

      if "First Day of Month.value" = "Monday", "Wednesday 3.value" = "17"

      if "First Day of Month.value" = "Tuesday", "Wednesday 3.value" = "16"

      if "First Day of Month.value" = "Wednesday", "Wednesday 3.value" = "15"

      if "First Day of Month.value" = "Thursday", "Wednesday 3" = "14"

      if "First Day of Month.value" = "Friday", "Wednesday 3.value" = "13"

      if "First Day of Month.value" = "Saturday", "Wednesday 3.value" = "12"

      else "Wednesday 3.value" = ""

       

      For "Sunday 5"

      if "First Day of Month.value" = "Sunday", "Sunday 5.value" = "29"

      if "First Day of Month.value" = "Friday", "Sunday 5.value" = "31"

      if "First Day of Month.value" = "Saturday", "Sunday 5.value" = "30"

      else "Sunday 5.value" = ""

       

      Is this possible? I have no doubt there's a better way to do it (with proper coding and everything), so any help would definitely be appreciated!