Hey Ernie,

What kind of error are you getting?  Anything?

You do not necessarily need to do a bind.  Just set the value of the control
explicitly from your script.

<cfformitem type="script">
    function clicked(){    
       var date1 ate  = getDateFromString(leavestartdate.text); 
       var date2 ate  = getDateFromString(leaveenddate.text); 
       if(leavestartdate.length != 0 && leaveenddate.length != 0){
            _root.leavedays.text = (date1 - date2)/(3600*24*1000); 
       }
    }
</cfformitem>
...

<cfinput label="Total Days:" type="text" name="leavedays"
value="#LEAVEDAYS#" width="45"/>

Also, don't forget, ActionScript is case sensetive.

Take Care,

Seth

-----Original Message-----
From: houcfug@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of [EMAIL PROTECTED]
Sent: Thursday, August 09, 2007 11:40 AM
To: houcfug@googlegroups.com
Subject: [houcfug] cfform.bind and datediff


Hi All,

I hope someone can help me with this, I am creating a form where the user
can select a start date and an end date in a cfform in a flash format.

I have been doing a lot of research trying to figure out this and I
haven't come up with something that will work in a bind to the cfinput.

Example:

<cfform name....>

<cfformitem type="script">
    function clicked(){    
       var date1 ate  = getDateFromString(leavestartdate.text); 
       var date2 ate  = getDateFromString(leaveenddate.text); 
       if(leavestartdate.length != 0 && leaveenddate.length != 0){
            leavedays.text = (date1 - date2)/(3600*24*1000); 
       }
    }
</cfformitem>

<cfformgroup type="hdividedbox">
                <cfformgroup type="page">
                        <cfformitem type="text"
style="font-weight:bold">Date & Time of Depature.</cfformitem>
                        <cfformgroup type="horizontal">

                                <cfinput label="Date:"
name="leavestartdate" validate="date" type="datefield"
value="#LEAVESTARTDATE#" width="100" />
                                <cfinput label="Time:"
name="leavestarttime" validate="time" type="text" value="#LEAVESTARTTIME#"
width="75" />
                    </cfformgroup>
                </cfformgroup>
                
                
                <cfformgroup type="page">
                        <cfformitem type="text"
style="font-weight:bold">Date & Time of Return.</cfformitem>
                        <cfformgroup type="horizontal"> 
                                <cfinput label="Date:" name="leaveenddate"
validate="date" type="datefield" value="#LEAVEENDDATE#" width="100" />
                                <cfinput label="Time:" name="leaveendtime"
validate="time" type="text" value="#LEAVEENDTIME#" width="75" />
                    </cfformgroup>
                </cfformgroup>
                </cfformgroup>

<cfinput label="Total Days:" type="text" name="LEAVEDAYS"
value="#LEAVEDAYS#" width="45" bind="{clicked();}" />
</cfform>


Thanks in advance
Ernie Pena
U.T. M. D. Anderson Cancer Center.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Houston ColdFusion 
Users' Group" discussion list.
To unsubscribe, send email to [EMAIL PROTECTED]
For more options, visit http://groups.google.com/group/houcfug?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to