PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/wheels/view/formsdateobject.cfm

http://cfwheels.googlecode.com/
ColdFusion | 132 lines | 130 code | 2 blank | 0 comment | 49 complexity | f02aa0fbd53bd4581dd8cd847f3ca24a MD5 | raw file
  1<cffunction name="dateSelect" returntype="string" access="public" output="false" hint="Builds and returns a string containing three select form controls for month, day, and year based on the supplied `objectName` and `property`."
  2	examples=
  3	'
  4		<!--- View code --->
  5		<cfoutput>
  6			##dateSelect(objectName="user", property="dateOfBirth")##
  7		</cfoutput>
  8		
  9		<!--- Show fields to select month and year --->
 10		<cfoutput>
 11			##dateSelect(objectName="order", property="expirationDate", order="month,year")##
 12		</cfoutput>
 13	'
 14	categories="view-helper,forms-object" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,textField,submitTag,radioButton,checkBox,passwordField,hiddenField,textArea,fileField,select,dateTimeSelect,timeSelect">
 15	<cfargument name="objectName" type="any" required="false" default="" hint="See documentation for @textField.">
 16	<cfargument name="property" type="string" required="false" default="" hint="See documentation for @textField.">
 17	<cfargument name="association" type="string" required="false" hint="See documentation for @textfield.">
 18	<cfargument name="position" type="string" required="false" hint="See documentation for @textfield.">
 19	<cfargument name="order" type="string" required="false" hint="Use to change the order of or exclude date select tags.">
 20	<cfargument name="separator" type="string" required="false" hint="Use to change the character that is displayed between the date select tags.">
 21	<cfargument name="startYear" type="numeric" required="false" hint="First year in select list.">
 22	<cfargument name="endYear" type="numeric" required="false" hint="Last year in select list.">
 23	<cfargument name="monthDisplay" type="string" required="false" hint="Pass in `names`, `numbers`, or `abbreviations` to control display.">
 24	<cfargument name="includeBlank" type="any" required="false" hint="See documentation for @select.">
 25	<cfargument name="label" type="string" required="false" hint="The label text to use in the form control. The label will be applied to all `select` tags, but you can pass in a list to cutomize each one individually.">
 26	<cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
 27	<cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
 28	<cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
 29	<cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
 30	<cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
 31	<cfargument name="errorElement" type="string" required="false" hint="See documentation for @textField.">
 32	<cfargument name="errorClass" type="string" required="false" hint="See documentation for @textField.">
 33	<cfargument name="combine" type="boolean" required="false" hint="Set to `false` to not combine the select parts into a single `DateTime` object.">
 34	<cfscript>
 35		$args(name="dateSelect", args=arguments);
 36		arguments.objectName = $objectName(argumentCollection=arguments);
 37		arguments.$functionName = "dateSelect";
 38	</cfscript>
 39	<cfreturn $dateOrTimeSelect(argumentCollection=arguments)>
 40</cffunction>
 41
 42<cffunction name="timeSelect" returntype="string" access="public" output="false" hint="Builds and returns a string containing three select form controls for hour, minute, and second based on the supplied `objectName` and `property`."
 43	examples=
 44	'
 45		<!--- View code --->
 46		<cfoutput>
 47		    ##timeSelect(objectName="business", property="openUntil")##
 48		</cfoutput>
 49		
 50		<!--- Show fields for hour and minute --->
 51		<cfoutput>
 52			##timeSelect(objectName="business", property="openUntil", order="hour,minute")##
 53		</cfoutput>
 54		
 55		<!--- Only show 15-minute intervals --->
 56		<cfoutput>
 57			##timeSelect(objectName="appointment", property="dateTimeStart", minuteStep=15)##
 58		</cfoutput>
 59	'
 60	categories="view-helper,forms-object" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,submitTag,textField,radioButton,checkBox,passwordField,hiddenField,textArea,fileField,select,dateTimeSelect,dateSelect">
 61	<cfargument name="objectName" type="any" required="false" default="" hint="See documentation for @textField.">
 62	<cfargument name="property" type="string" required="false" default="" hint="See documentation for @textField.">
 63	<cfargument name="association" type="string" required="false" hint="See documentation for @textfield.">
 64	<cfargument name="position" type="string" required="false" hint="See documentation for @textfield.">
 65	<cfargument name="order" type="string" required="false" hint="Use to change the order of or exclude time select tags.">
 66	<cfargument name="separator" type="string" required="false" hint="Use to change the character that is displayed between the time select tags.">
 67	<cfargument name="minuteStep" type="numeric" required="false" hint="Pass in `10` to only show minute 10, 20, 30, etc.">
 68	<cfargument name="includeBlank" type="any" required="false" hint="See documentation for @select.">
 69	<cfargument name="label" type="string" required="false" hint="See documentation for @dateSelect.">
 70	<cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
 71	<cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
 72	<cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
 73	<cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
 74	<cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
 75	<cfargument name="errorElement" type="string" required="false" hint="See documentation for @textField.">
 76	<cfargument name="errorClass" type="string" required="false" hint="See documentation for @textField.">
 77	<cfargument name="combine" type="boolean" required="false" hint="See documentation for @dateSelect.">
 78	<cfargument name="twelveHour" type="boolean" required="false" default="false" hint="whether to display the hours in 24 or 12 hour format. 12 hour format has AM/PM drop downs">
 79	<cfscript>
 80		$args(name="timeSelect", args=arguments);
 81		arguments.objectName = $objectName(argumentCollection=arguments);
 82		arguments.$functionName = "timeSelect";
 83	</cfscript>
 84	<cfreturn $dateOrTimeSelect(argumentCollection=arguments)>
 85</cffunction>
 86
 87<cffunction name="dateTimeSelect" returntype="string" access="public" output="false" hint="Builds and returns a string containing six select form controls (three for date selection and the remaining three for time selection) based on the supplied `objectName` and `property`."
 88	examples=
 89	'
 90		<!--- View code --->
 91		<cfoutput>
 92		    ##dateTimeSelect(objectName="article", property="publishedAt")##
 93		</cfoutput>
 94		
 95		<!--- Show fields for month, day, hour, and minute --->
 96		<cfoutput>
 97			##dateTimeSelect(objectName="appointment", property="dateTimeStart", dateOrder="month,day", timeOrder="hour,minute")##
 98		</cfoutput>
 99	'
100	categories="view-helper,forms-object" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,submitTag,textField,radioButton,checkBox,passwordField,hiddenField,textArea,fileField,select,dateSelect,timeSelect">
101	<cfargument name="objectName" type="string" required="true" hint="See documentation for @textField.">
102	<cfargument name="property" type="string" required="true" hint="See documentation for @textField.">
103	<cfargument name="association" type="string" required="false" hint="See documentation for @textfield.">
104	<cfargument name="position" type="string" required="false" hint="See documentation for @textfield.">
105	<cfargument name="dateOrder" type="string" required="false" hint="Use to change the order of or exclude date select tags.">
106	<cfargument name="dateSeparator" type="string" required="false" hint="Use to change the character that is displayed between the date select tags.">
107	<cfargument name="startYear" type="numeric" required="false" hint="See documentation for @dateSelect.">
108	<cfargument name="endYear" type="numeric" required="false" hint="See documentation for @dateSelect.">
109	<cfargument name="monthDisplay" type="string" required="false" hint="See documentation for @dateSelect.">
110	<cfargument name="timeOrder" type="string" required="false" hint="Use to change the order of or exclude time select tags.">
111	<cfargument name="timeSeparator" type="string" required="false" hint="Use to change the character that is displayed between the time select tags.">
112	<cfargument name="minuteStep" type="numeric" required="false" hint="See documentation for @timeSelect.">
113	<cfargument name="separator" type="string" required="false" hint="Use to change the character that is displayed between the first and second set of select tags.">
114	<cfargument name="includeBlank" type="any" required="false" hint="See documentation for @select.">
115	<cfargument name="label" type="string" required="false" hint="See documentation for @dateSelect.">
116	<cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
117	<cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
118	<cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
119	<cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
120	<cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
121	<cfargument name="errorElement" type="string" required="false" hint="See documentation for @textField.">
122	<cfargument name="errorClass" type="string" required="false" hint="See documentation for @textField.">
123	<cfargument name="combine" type="boolean" required="false" hint="See documentation for @dateSelect.">
124	<cfargument name="twelveHour" type="boolean" required="false" default="false" hint="See documentation for @timeSelect.">
125	<cfscript>
126		$args(name="dateTimeSelect", reserved="name", args=arguments);
127		arguments.objectName = $objectName(argumentCollection=arguments);
128		arguments.name = $tagName(arguments.objectName, arguments.property);
129		arguments.$functionName = "dateTimeSelect";
130	</cfscript>
131	<cfreturn dateTimeSelectTags(argumentCollection=arguments)>
132</cffunction>