View Full Version : Dynamically Change Info - Need Help Fast Please!

11-03-2006, 11:50 PM

Here is my problem: I have a pop up calendar that allows visitors to select a certain date. I also have a Drop Down list with five options. What I need to happen is that depending on what option is selected, the calendar disables certain days of the week based on the option that is chosen, BEFORE the form is submitted,

This is the applicable portion of the code:

<select name="shippingMethod">
<option value="##"></option>
<option value="01">Option 1</option>
<option value="02">Option 2</option>
<option value="03">Option 3</option>
<option value="04">Option 4</option>
<option value="05">Option 5</option>

<input readonly type="text" class="disable-days-67" name="delDate" size="9" maxlength="10" value="">

What I need to happen is for example, if the visitor selects Option 1, I need the calendar to automatically disable days 67… if Option2 I need to automatically disable days 1267… Option 3, 267… Option 4, 267… and Option 5, 67.

In other words, what I highlighted in bold red above needs to automatically change depending on what option is selected.

Can any one help? Is this even possible?

The reason for this is my Drop Down List is populated with Shipping Options but not all options are available on each day of the week. What I need is for the calendar to automatically disable certain days of the week based on their Shipping Method selection so that the visitor can’t select a date that is not available.

Hope that makes sense… Any help would be greatly appreciated. Thanks.

11-04-2006, 12:05 AM
I've worked some in the past with objects that get created after the page loads. In this case, if I understand you correctly, you aren't really needing to create a new object, but instead call a function that changes the calendar.

First, I'm not sure of the Calendar code you have. I use a popup calendar that is composed through a function and put in a div that appears next to a date field.

What you'd do is probably call a function when your dialog field changes which will set a variable on your document that the calendar code can read to determine which dates become non-clickable.

Make sense? It's not particularly easy, but it would work. You'll need to understand your calendar code better and have it in a function and composed when an action occurs or a button clicked. So to sum it up:

1. Your Dialog box onchange will call a function with the value of the current field passed to it, like changeCalendar( value )
2. The changeCalendar() function will set a variable on the document to include the dates that should be disabled. It will then call the calendar code.
3. Whenever the calendar code function is run, whether right away or when a user clicks on an action or button it will reference the variable to determine which dates are disabled or made not clickable.

Good Luck.

Tim Williams