Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

cfinput date range?

New Here ,
Sep 10, 2008 Sep 10, 2008
Is it possible to use the range attribute for cfinput for a range of dates in CF 7?
I'm not finding any examples on how to accomplish this.

Thanks.
744
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 10, 2008 Sep 10, 2008
I don't think so. You can always write your own js to do that. Or you can do it with cold fusion when the form is submitted. Or you can do both.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Sep 10, 2008 Sep 10, 2008
Set a minimum and maximum date that can be selected? I do not think there is a built in CF property for that. But it is possible using action script. Try this tip from Nick Watson, but use the selectableRange property instead of disabledRanges
http://weblogs.macromedia.com/nwatson/archives/2006/03/disable_calenda.cfm

The sample uses the less elegant cfsavecontent method. If you are running 7.0.1 (?) you could use <cfformitem type="script"> instead.

<!--- set the allowed ranges for the calendar --->
<cfset startDate = "09/15/2008">
<cfset endDate = "09/20/2008">

<cfoutput>
<cfsavecontent variable="loadFields">
<!--- this is not allowed with mx 7
//var #ToScript( parseDateTime(startDate), "startDate", false, false)#
//var #ToScript( parseDateTime(endDate), "endDate", false, false)#
--->
var startDate:Date = mx.formatters.DateFormatter.parseDateString("#startDate#");
var endDate:Date = mx.formatters.DateFormatter.parseDateString("#endDate#");
testDate.selectableRange = {rangeStart:startDate, rangeEnd:endDate};
</cfsavecontent>
</cfoutput>

<cfform name="testForm" format="flash" onLoad="#loadFields#" width="200">
<cfinput type="datefield" name="testDate" >
</cfform>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Sep 10, 2008 Sep 10, 2008
LATEST
> Is it possible to use the range attribute for cfinput for a range

I was assuming you meant with a <cfinput type="datefield"...>. If not, disregard my response. It does not apply.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources