Gyannuzzi,
I am still looking into the problem. I'm finding it quite tricky. In the
meantime, here are some ideas that may inspire you or someone else.
The most straightforward way is to place the date dynamically into the
datefield's value attribute, thus, [i]value="#selected_travel_date#"[/i]. But
then, we hit a snag immediately. The [i]value[/i] attribute is not an event.
So, its value can be evaluated from a Coldfusion variable, but not from an
Actionscript variable. Yet the value is readily available to us, in
Actionscript, not in Coldfusion.
I have not considered any solution in Coldfusion or in client-side script. I
have the feeling it would be messy. I thought adding/modifying the following
lines would do it
<cfgrid name="geoGrid" autowidth="yes" height = "120" rowheaders="no"
onchange="onGridSelect();">
<cfformitem type="script">
function onGridSelect(){
travelDate2.selectedDate=geoGrid.selectedItem.travelDate;
}
</cfformitem>
<cfinput name="travelDate2" type="datefield" label="Travel Date" width="100" />
But it doesn't seem to help. I only get what you already got with [i]bind[/i].
I think the calendar doesn't respond because
[i]geoGrid.selectedItem.travelDate[/i] is a string. Actionscript alternatives
like
cities.traveldate2=geoGrid.selectedItem.travelDate;
also fall short for the same reason. Coldfusion apparently expects a Date
object there. However, we cannot get a Date object because the Coldfusion Flash
compiler forbids the use of the keyword "new" in a script.
I came tantalizingly close, using the
http://livedocs.adobe.com/flash/mx2004/main_7_2/00002381.html. function gridSelect(){
travelDate2.setFocus();
// travelDate2.showToday=False;
// alert('day: '+geoGrid.selectedItem.travelDate.split("/")[1]+', but how to
enter day number in calendar?');
travelDate2.displayedMonth=geoGrid.selectedItem.travelDate.split("/")[0]-1;
travelDate2.displayedYear=geoGrid.selectedItem.travelDate.split("/")[2];
}
<cfinput name="travelDate2" type="datefield"
bind="{geoGrid.selectedItem.travelDate}" label="Travel Date" width="100" />
I could get everything to display, except the day. There is a
[i]displayedMonth[/i] and a [i]displayedYear[/i] property, but, alas, no
[i]displayedDay[/i]. Anyone with a flash?