/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. <!--- Show fields to select month and year --->
  9. <cfoutput>
  10. ##dateSelect(objectName="order", property="expirationDate", order="month,year")##
  11. </cfoutput>
  12. '
  13. 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">
  14. <cfargument name="objectName" type="any" required="false" default="" hint="See documentation for @textField.">
  15. <cfargument name="property" type="string" required="false" default="" hint="See documentation for @textField.">
  16. <cfargument name="association" type="string" required="false" hint="See documentation for @textfield.">
  17. <cfargument name="position" type="string" required="false" hint="See documentation for @textfield.">
  18. <cfargument name="order" type="string" required="false" hint="Use to change the order of or exclude date select tags.">
  19. <cfargument name="separator" type="string" required="false" hint="Use to change the character that is displayed between the date select tags.">
  20. <cfargument name="startYear" type="numeric" required="false" hint="First year in select list.">
  21. <cfargument name="endYear" type="numeric" required="false" hint="Last year in select list.">
  22. <cfargument name="monthDisplay" type="string" required="false" hint="Pass in `names`, `numbers`, or `abbreviations` to control display.">
  23. <cfargument name="includeBlank" type="any" required="false" hint="See documentation for @select.">
  24. <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.">
  25. <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
  26. <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
  27. <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
  28. <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
  29. <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
  30. <cfargument name="errorElement" type="string" required="false" hint="See documentation for @textField.">
  31. <cfargument name="errorClass" type="string" required="false" hint="See documentation for @textField.">
  32. <cfargument name="combine" type="boolean" required="false" hint="Set to `false` to not combine the select parts into a single `DateTime` object.">
  33. <cfscript>
  34. $args(name="dateSelect", args=arguments);
  35. arguments.objectName = $objectName(argumentCollection=arguments);
  36. arguments.$functionName = "dateSelect";
  37. </cfscript>
  38. <cfreturn $dateOrTimeSelect(argumentCollection=arguments)>
  39. </cffunction>
  40. <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`."
  41. examples=
  42. '
  43. <!--- View code --->
  44. <cfoutput>
  45. ##timeSelect(objectName="business", property="openUntil")##
  46. </cfoutput>
  47. <!--- Show fields for hour and minute --->
  48. <cfoutput>
  49. ##timeSelect(objectName="business", property="openUntil", order="hour,minute")##
  50. </cfoutput>
  51. <!--- Only show 15-minute intervals --->
  52. <cfoutput>
  53. ##timeSelect(objectName="appointment", property="dateTimeStart", minuteStep=15)##
  54. </cfoutput>
  55. '
  56. 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">
  57. <cfargument name="objectName" type="any" required="false" default="" hint="See documentation for @textField.">
  58. <cfargument name="property" type="string" required="false" default="" hint="See documentation for @textField.">
  59. <cfargument name="association" type="string" required="false" hint="See documentation for @textfield.">
  60. <cfargument name="position" type="string" required="false" hint="See documentation for @textfield.">
  61. <cfargument name="order" type="string" required="false" hint="Use to change the order of or exclude time select tags.">
  62. <cfargument name="separator" type="string" required="false" hint="Use to change the character that is displayed between the time select tags.">
  63. <cfargument name="minuteStep" type="numeric" required="false" hint="Pass in `10` to only show minute 10, 20, 30, etc.">
  64. <cfargument name="includeBlank" type="any" required="false" hint="See documentation for @select.">
  65. <cfargument name="label" type="string" required="false" hint="See documentation for @dateSelect.">
  66. <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
  67. <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
  68. <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
  69. <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
  70. <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
  71. <cfargument name="errorElement" type="string" required="false" hint="See documentation for @textField.">
  72. <cfargument name="errorClass" type="string" required="false" hint="See documentation for @textField.">
  73. <cfargument name="combine" type="boolean" required="false" hint="See documentation for @dateSelect.">
  74. <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">
  75. <cfscript>
  76. $args(name="timeSelect", args=arguments);
  77. arguments.objectName = $objectName(argumentCollection=arguments);
  78. arguments.$functionName = "timeSelect";
  79. </cfscript>
  80. <cfreturn $dateOrTimeSelect(argumentCollection=arguments)>
  81. </cffunction>
  82. <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`."
  83. examples=
  84. '
  85. <!--- View code --->
  86. <cfoutput>
  87. ##dateTimeSelect(objectName="article", property="publishedAt")##
  88. </cfoutput>
  89. <!--- Show fields for month, day, hour, and minute --->
  90. <cfoutput>
  91. ##dateTimeSelect(objectName="appointment", property="dateTimeStart", dateOrder="month,day", timeOrder="hour,minute")##
  92. </cfoutput>
  93. '
  94. 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">
  95. <cfargument name="objectName" type="string" required="true" hint="See documentation for @textField.">
  96. <cfargument name="property" type="string" required="true" hint="See documentation for @textField.">
  97. <cfargument name="association" type="string" required="false" hint="See documentation for @textfield.">
  98. <cfargument name="position" type="string" required="false" hint="See documentation for @textfield.">
  99. <cfargument name="dateOrder" type="string" required="false" hint="Use to change the order of or exclude date select tags.">
  100. <cfargument name="dateSeparator" type="string" required="false" hint="Use to change the character that is displayed between the date select tags.">
  101. <cfargument name="startYear" type="numeric" required="false" hint="See documentation for @dateSelect.">
  102. <cfargument name="endYear" type="numeric" required="false" hint="See documentation for @dateSelect.">
  103. <cfargument name="monthDisplay" type="string" required="false" hint="See documentation for @dateSelect.">
  104. <cfargument name="timeOrder" type="string" required="false" hint="Use to change the order of or exclude time select tags.">
  105. <cfargument name="timeSeparator" type="string" required="false" hint="Use to change the character that is displayed between the time select tags.">
  106. <cfargument name="minuteStep" type="numeric" required="false" hint="See documentation for @timeSelect.">
  107. <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.">
  108. <cfargument name="includeBlank" type="any" required="false" hint="See documentation for @select.">
  109. <cfargument name="label" type="string" required="false" hint="See documentation for @dateSelect.">
  110. <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
  111. <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
  112. <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
  113. <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
  114. <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
  115. <cfargument name="errorElement" type="string" required="false" hint="See documentation for @textField.">
  116. <cfargument name="errorClass" type="string" required="false" hint="See documentation for @textField.">
  117. <cfargument name="combine" type="boolean" required="false" hint="See documentation for @dateSelect.">
  118. <cfargument name="twelveHour" type="boolean" required="false" default="false" hint="See documentation for @timeSelect.">
  119. <cfscript>
  120. $args(name="dateTimeSelect", reserved="name", args=arguments);
  121. arguments.objectName = $objectName(argumentCollection=arguments);
  122. arguments.name = $tagName(arguments.objectName, arguments.property);
  123. arguments.$functionName = "dateTimeSelect";
  124. </cfscript>
  125. <cfreturn dateTimeSelectTags(argumentCollection=arguments)>
  126. </cffunction>