Zend_Dojo-Form-Elements.xml 58 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect2 id="zend.dojo.form.elements">
  4. <title>Dijit-Specific Form Elements</title>
  5. <para>
  6. Each form dijit for which a view helper is provided has a corresponding
  7. <classname>Zend_Form</classname> element. All of them have the following methods
  8. available for manipulating dijit parameters:
  9. </para>
  10. <itemizedlist>
  11. <listitem><para>
  12. <methodname>setDijitParam($key, $value)</methodname>: set a single dijit
  13. parameter. If the dijit parameter already exists, it will be
  14. overwritten.
  15. </para></listitem>
  16. <listitem><para>
  17. <methodname>setDijitParams(array $params)</methodname>: set several dijit
  18. parameters at once. Any passed parameters matching those
  19. already present will overwrite.
  20. </para></listitem>
  21. <listitem><para>
  22. <methodname>hasDijitParam($key)</methodname>: If a given dijit parameter
  23. is defined and present, return <constant>TRUE</constant>, otherwise return
  24. <constant>FALSE</constant>.
  25. </para></listitem>
  26. <listitem><para>
  27. <methodname>getDijitParam($key)</methodname>: retrieve the given dijit
  28. parameter. If not available, a <constant>NULL</constant> value is returned.
  29. </para></listitem>
  30. <listitem><para>
  31. <methodname>getDijitParams()</methodname>: retrieve all dijit parameters.
  32. </para></listitem>
  33. <listitem><para>
  34. <methodname>removeDijitParam($key)</methodname>: remove the given dijit
  35. parameter.
  36. </para></listitem>
  37. <listitem><para>
  38. <methodname>clearDijitParams()</methodname>: clear all currently defined
  39. dijit parameters.
  40. </para></listitem>
  41. </itemizedlist>
  42. <para>
  43. Dijit parameters are stored in the <property>dijitParams</property> public
  44. property. Thus, you can dijit-enable an existing form element simply by
  45. setting this property on the element; you simply will not have the
  46. above accessors to facilitate manipulating the parameters.
  47. </para>
  48. <para>
  49. Additionally, dijit-specific elements implement a different list of
  50. decorators, corresponding to the following:
  51. </para>
  52. <programlisting language="php"><![CDATA[
  53. $element->addDecorator('DijitElement')
  54. ->addDecorator('Errors')
  55. ->addDecorator('HtmlTag', array('tag' => 'dd'))
  56. ->addDecorator('Label', array('tag' => 'dt'));
  57. ]]></programlisting>
  58. <para>
  59. In effect, the DijitElement decorator is used in place of the standard
  60. ViewHelper decorator.
  61. </para>
  62. <para>
  63. Finally, the base Dijit element ensures that the Dojo view helper path
  64. is set on the view.
  65. </para>
  66. <para>
  67. A variant on DijitElement, DijitMulti, provides the functionality of
  68. the <classname>Multi</classname> abstract form element, allowing the developer to
  69. specify 'multiOptions' -- typically select options or radio options.
  70. </para>
  71. <para>
  72. The following dijit elements are shipped in the standard Zend
  73. Framework distribution.
  74. </para>
  75. <sect3 id="zend.dojo.form.elements.button">
  76. <title>Button</title>
  77. <para>
  78. While not deriving from <link
  79. linkend="zend.form.standardElements.button">the standard Button
  80. element</link>, it does implement the same functionality, and
  81. can be used as a drop-in replacement for it. The following
  82. functionality is exposed:
  83. </para>
  84. <itemizedlist>
  85. <listitem><para>
  86. <methodname>getLabel()</methodname> will utilize the element name as the
  87. button label if no name is provided. Additionally, it will
  88. translate the name if a translation adapter with a matching
  89. translation message is available.
  90. </para></listitem>
  91. <listitem><para>
  92. <methodname>isChecked()</methodname> determines if the value submitted
  93. matches the label; if so, it returns <constant>TRUE</constant>. This is useful for
  94. determining which button was used when a form was submitted.
  95. </para></listitem>
  96. </itemizedlist>
  97. <para>
  98. Additionally, only the decorators <classname>DijitElement</classname> and
  99. <classname>DtDdWrapper</classname> are utilized for Button elements.
  100. </para>
  101. <example id="zend.dojo.form.elements.button.example">
  102. <title>Example Button dijit element usage</title>
  103. <programlisting language="php"><![CDATA[
  104. $form->addElement(
  105. 'Button',
  106. 'foo',
  107. array(
  108. 'label' => 'Button Label',
  109. )
  110. );
  111. ]]></programlisting>
  112. </example>
  113. </sect3>
  114. <sect3 id="zend.dojo.form.elements.checkBox">
  115. <title>CheckBox</title>
  116. <para>
  117. While not deriving from <link
  118. linkend="zend.form.standardElements.checkbox">the standard
  119. Checkbox element</link>, it does implement the same
  120. functionality. This means that the following methods are exposed:
  121. </para>
  122. <itemizedlist>
  123. <listitem><para>
  124. <methodname>setCheckedValue($value)</methodname>: set the value to use when
  125. the element is checked.
  126. </para></listitem>
  127. <listitem><para>
  128. <methodname>getCheckedValue()</methodname>: get the value of the item to
  129. use when checked.
  130. </para></listitem>
  131. <listitem><para>
  132. <methodname>setUncheckedValue($value)</methodname>: set the value of the
  133. item to use when it is unchecked.
  134. </para></listitem>
  135. <listitem><para>
  136. <methodname>getUncheckedValue()</methodname>: get the value of the item to
  137. use when it is unchecked.
  138. </para></listitem>
  139. <listitem><para>
  140. <methodname>setChecked($flag)</methodname>: mark the element as checked or
  141. unchecked.
  142. </para></listitem>
  143. <listitem><para>
  144. <methodname>isChecked()</methodname>: determine if the element is currently
  145. checked.
  146. </para></listitem>
  147. </itemizedlist>
  148. <example id="zend.dojo.form.elements.checkBox.example">
  149. <title>Example CheckBox dijit element usage</title>
  150. <programlisting language="php"><![CDATA[
  151. $form->addElement(
  152. 'CheckBox',
  153. 'foo',
  154. array(
  155. 'label' => 'A check box',
  156. 'checkedValue' => 'foo',
  157. 'uncheckedValue' => 'bar',
  158. 'checked' => true,
  159. )
  160. );
  161. ]]></programlisting>
  162. </example>
  163. </sect3>
  164. <sect3 id="zend.dojo.form.elements.comboBox">
  165. <title>ComboBox and FilteringSelect</title>
  166. <para>
  167. As noted in the ComboBox <link
  168. linkend="zend.dojo.view.dijit.form">dijit view helper
  169. documentation</link>, ComboBoxes are a hybrid between select
  170. and text input, allowing for autocompletion and the ability to
  171. specify an alternate to the options provided. FilteringSelects are
  172. the same, but do not allow arbitrary input.
  173. </para>
  174. <note>
  175. <title>ComboBoxes return the label values</title>
  176. <para>
  177. ComboBoxes return the label values, and not the option values,
  178. which can lead to a disconnect in expectations. For this reason,
  179. ComboBoxes do not auto-register an <classname>InArray</classname>
  180. validator (though FilteringSelects do).
  181. </para>
  182. </note>
  183. <para>
  184. The ComboBox and FilteringSelect form elements provide accessors and mutators for
  185. examining and setting the select options as well as specifying a
  186. dojo.data datastore (if used). They extend from DijitMulti, which
  187. allows you to specify select options via the
  188. <methodname>setMultiOptions()</methodname> and <methodname>setMultiOption()</methodname>
  189. methods. In addition, the following methods are available:
  190. </para>
  191. <itemizedlist>
  192. <listitem><para>
  193. <methodname>getStoreInfo()</methodname>: get all datastore information
  194. currently set. Returns an empty array if no data is currently
  195. set.
  196. </para></listitem>
  197. <listitem><para>
  198. <methodname>setStoreId($identifier)</methodname>: set the store identifier
  199. variable (usually referred to by the attribute 'jsId' in Dojo).
  200. This should be a valid javascript variable name.
  201. </para></listitem>
  202. <listitem><para>
  203. <methodname>getStoreId()</methodname>: retrieve the store identifier
  204. variable name.
  205. </para></listitem>
  206. <listitem><para>
  207. <methodname>setStoreType($dojoType)</methodname>: set the datastore class
  208. to use; e.g., "dojo.data.ItemFileReadStore".
  209. </para></listitem>
  210. <listitem><para>
  211. <methodname>getStoreType()</methodname>: get the dojo datastore class to
  212. use.
  213. </para></listitem>
  214. <listitem><para>
  215. <methodname>setStoreParams(array $params)</methodname>: set any parameters
  216. used to configure the datastore object. As an example,
  217. dojo.data.ItemFileReadStore datastore would expect a 'url'
  218. parameter pointing to a location that would return the
  219. dojo.data object.
  220. </para></listitem>
  221. <listitem><para>
  222. <methodname>getStoreParams()</methodname>: get any datastore parameters
  223. currently set; if none, an empty array is returned.
  224. </para></listitem>
  225. <listitem><para>
  226. <methodname>setAutocomplete($flag)</methodname>: indicate whether or not
  227. the selected item will be used when the user leaves the
  228. element.
  229. </para></listitem>
  230. <listitem><para>
  231. <methodname>getAutocomplete()</methodname>: get the value of the
  232. autocomplete flag.
  233. </para></listitem>
  234. </itemizedlist>
  235. <para>
  236. By default, if no dojo.data store is registered with the element,
  237. this element registers an <classname>InArray</classname> validator which
  238. validates against the array keys of registered options. You can
  239. disable this behavior by either calling
  240. <methodname>setRegisterInArrayValidator(false)</methodname>, or by passing a
  241. <constant>FALSE</constant> value to the <property>registerInArrayValidator</property>
  242. configuration key.
  243. </para>
  244. <example id="zend.dojo.form.elements.comboBox.selectExample">
  245. <title>ComboBox dijit element usage as select input</title>
  246. <programlisting language="php"><![CDATA[
  247. $form->addElement(
  248. 'ComboBox',
  249. 'foo',
  250. array(
  251. 'label' => 'ComboBox (select)',
  252. 'value' => 'blue',
  253. 'autocomplete' => false,
  254. 'multiOptions' => array(
  255. 'red' => 'Rouge',
  256. 'blue' => 'Bleu',
  257. 'white' => 'Blanc',
  258. 'orange' => 'Orange',
  259. 'black' => 'Noir',
  260. 'green' => 'Vert',
  261. ),
  262. )
  263. );
  264. ]]></programlisting>
  265. </example>
  266. <example id="zend.dojo.form.elements.comboBox.datastoreExample">
  267. <title>ComboBox dijit element usage with datastore</title>
  268. <programlisting language="php"><![CDATA[
  269. $form->addElement(
  270. 'ComboBox',
  271. 'foo',
  272. array(
  273. 'label' => 'ComboBox (datastore)',
  274. 'storeId' => 'stateStore',
  275. 'storeType' => 'dojo.data.ItemFileReadStore',
  276. 'storeParams' => array(
  277. 'url' => '/js/states.txt',
  278. ),
  279. 'dijitParams' => array(
  280. 'searchAttr' => 'name',
  281. ),
  282. )
  283. );
  284. ]]></programlisting>
  285. </example>
  286. <para>
  287. The above examples could also utilize <classname>FilteringSelect</classname>
  288. instead of <classname>ComboBox</classname>.
  289. </para>
  290. </sect3>
  291. <sect3 id="zend.dojo.form.elements.currencyTextBox">
  292. <title>CurrencyTextBox</title>
  293. <para>
  294. The CurrencyTextBox is primarily for supporting currency input. The
  295. currency may be localized, and can support both fractional and
  296. non-fractional values.
  297. </para>
  298. <para>
  299. Internally, CurrencyTextBox derives from <link
  300. linkend="zend.dojo.form.elements.numberTextBox">NumberTextBox</link>,
  301. <link
  302. linkend="zend.dojo.form.elements.validationTextBox">ValidationTextBox</link>,
  303. and <link linkend="zend.dojo.form.elements.textBox">TextBox</link>;
  304. all methods available to those classes are available. In addition,
  305. the following constraint methods can be used:
  306. </para>
  307. <itemizedlist>
  308. <listitem><para>
  309. <methodname>setCurrency($currency)</methodname>: set the currency type to
  310. use; should follow the <ulink
  311. url="http://en.wikipedia.org/wiki/ISO_4217">ISO-4217</ulink>
  312. specification.
  313. </para></listitem>
  314. <listitem><para>
  315. <methodname>getCurrency()</methodname>: retrieve the current currency type.
  316. </para></listitem>
  317. <listitem><para>
  318. <methodname>setSymbol($symbol)</methodname>: set the 3-letter <ulink
  319. url="http://en.wikipedia.org/wiki/ISO_4217">ISO-4217</ulink>
  320. currency symbol to use.
  321. </para></listitem>
  322. <listitem><para>
  323. <methodname>getSymbol()</methodname>: get the current currency symbol.
  324. </para></listitem>
  325. <listitem><para>
  326. <methodname>setFractional($flag)</methodname>: set whether or not the
  327. currency should allow for fractional values.
  328. </para></listitem>
  329. <listitem><para>
  330. <methodname>getFractional()</methodname>: retrieve the status of the
  331. fractional flag.
  332. </para></listitem>
  333. </itemizedlist>
  334. <example id="zend.dojo.form.elements.currencyTextBox.example">
  335. <title>Example CurrencyTextBox dijit element usage</title>
  336. <programlisting language="php"><![CDATA[
  337. $form->addElement(
  338. 'CurrencyTextBox',
  339. 'foo',
  340. array(
  341. 'label' => 'Currency:',
  342. 'required' => true,
  343. 'currency' => 'USD',
  344. 'invalidMessage' => 'Invalid amount. ' .
  345. 'Include dollar sign, commas, and cents.',
  346. 'fractional' => false,
  347. )
  348. );
  349. ]]></programlisting>
  350. </example>
  351. </sect3>
  352. <sect3 id="zend.dojo.form.elements.dateTextBox">
  353. <title>DateTextBox</title>
  354. <para>
  355. DateTextBox provides a calendar drop-down for selecting a date, as
  356. well as client-side date validation and formatting.
  357. </para>
  358. <para>
  359. Internally, DateTextBox derives from <link
  360. linkend="zend.dojo.form.elements.validationTextBox">ValidationTextBox</link>
  361. and <link linkend="zend.dojo.form.elements.textBox">TextBox</link>;
  362. all methods available to those classes are available. In addition,
  363. the following methods can be used to set individual constraints:
  364. </para>
  365. <itemizedlist>
  366. <listitem><para>
  367. <methodname>setAmPm($flag)</methodname> and <methodname>getAmPm()</methodname>:
  368. Whether or not to use AM/PM strings in times.
  369. </para></listitem>
  370. <listitem><para>
  371. <methodname>setStrict($flag)</methodname> and <methodname>getStrict()</methodname>:
  372. whether or not to use strict regular expression matching when
  373. validating input. If <constant>FALSE</constant>, which is the default, it will be
  374. lenient about whitespace and some abbreviations.
  375. </para></listitem>
  376. <listitem><para>
  377. <methodname>setLocale($locale)</methodname> and
  378. <methodname>getLocale()</methodname>: Set and retrieve the locale to use with this
  379. specific element.
  380. </para></listitem>
  381. <listitem><para>
  382. <methodname>setDatePattern($pattern)</methodname> and
  383. <methodname>getDatePattern()</methodname>: provide and retrieve the <ulink
  384. url="http://www.unicode.org/reports/tr35/#Date_Format_Patterns">unicode
  385. date format pattern</ulink> for formatting the date.
  386. </para></listitem>
  387. <listitem><para>
  388. <methodname>setFormatLength($formatLength)</methodname> and
  389. <methodname>getFormatLength()</methodname>: provide and retrieve the format
  390. length type to use; should be one of "long", "short", "medium"
  391. or "full".
  392. </para></listitem>
  393. <listitem><para>
  394. <methodname>setSelector($selector)</methodname> and
  395. <methodname>getSelector()</methodname>: provide and retrieve the style of
  396. selector; should be either "date" or "time".
  397. </para></listitem>
  398. </itemizedlist>
  399. <example id="zend.dojo.form.elements.dateTextBox.example">
  400. <title>Example DateTextBox dijit element usage</title>
  401. <programlisting language="php"><![CDATA[
  402. $form->addElement(
  403. 'DateTextBox',
  404. 'foo',
  405. array(
  406. 'label' => 'Date:',
  407. 'required' => true,
  408. 'invalidMessage' => 'Invalid date specified.',
  409. 'formatLength' => 'long',
  410. )
  411. );
  412. ]]></programlisting>
  413. </example>
  414. </sect3>
  415. <sect3 id="zend.dojo.form.elements.editor">
  416. <title>Editor</title>
  417. <para>
  418. Editor provides a WYSIWYG editor that can be used to both create and
  419. edit rich HTML content. dijit.Editor is pluggable and may be
  420. extended with custom plugins if desired; see <ulink
  421. url="http://dojotoolkit.org/book/dojo-book-0-9/part-2-dijit/advanced-editing-and-display/editor-rich-text">the
  422. dijit.Editor documentation</ulink> for more details.
  423. </para>
  424. <para>
  425. The Editor form element provides a number of accessors and mutators
  426. for manipulating various dijit parameters, as follows:
  427. </para>
  428. <itemizedlist>
  429. <listitem>
  430. <para>
  431. <emphasis>captureEvents</emphasis> are events that connect
  432. to the editing area itself. The following accessors and
  433. mutators are available for manipulating capture events:
  434. </para>
  435. <itemizedlist>
  436. <listitem>
  437. <para><methodname>addCaptureEvent($event)</methodname></para>
  438. </listitem>
  439. <listitem>
  440. <para><methodname>addCaptureEvents(array $events)</methodname></para>
  441. </listitem>
  442. <listitem>
  443. <para><methodname>setCaptureEvents(array $events)</methodname></para>
  444. </listitem>
  445. <listitem><para><methodname>getCaptureEvents()</methodname></para></listitem>
  446. <listitem>
  447. <para><methodname>hasCaptureEvent($event)</methodname></para>
  448. </listitem>
  449. <listitem>
  450. <para><methodname>removeCaptureEvent($event)</methodname></para>
  451. </listitem>
  452. <listitem>
  453. <para><methodname>clearCaptureEvents()</methodname></para>
  454. </listitem>
  455. </itemizedlist>
  456. </listitem>
  457. <listitem>
  458. <para>
  459. <emphasis>events</emphasis> are standard DOM events, such as
  460. onClick, onKeyUp, etc. The following accessors and mutators
  461. are available for manipulating events:
  462. </para>
  463. <itemizedlist>
  464. <listitem><para><methodname>addEvent($event)</methodname></para></listitem>
  465. <listitem>
  466. <para><methodname>addEvents(array $events)</methodname></para>
  467. </listitem>
  468. <listitem>
  469. <para><methodname>setEvents(array $events)</methodname></para>
  470. </listitem>
  471. <listitem><para><methodname>getEvents()</methodname></para></listitem>
  472. <listitem><para><methodname>hasEvent($event)</methodname></para></listitem>
  473. <listitem><para><methodname>removeEvent($event)</methodname></para></listitem>
  474. <listitem><para><methodname>clearEvents()</methodname></para></listitem>
  475. </itemizedlist>
  476. </listitem>
  477. <listitem>
  478. <para>
  479. <emphasis>plugins</emphasis> add functionality to the
  480. Editor -- additional tools for the toolbar, additional
  481. styles to allow, etc. The following accessors and mutators
  482. are available for manipulating plugins:
  483. </para>
  484. <itemizedlist>
  485. <listitem><para><methodname>addPlugin($plugin)</methodname></para></listitem>
  486. <listitem>
  487. <para><methodname>addPlugins(array $plugins)</methodname></para>
  488. </listitem>
  489. <listitem>
  490. <para><methodname>setPlugins(array $plugins)</methodname></para>
  491. </listitem>
  492. <listitem><para><methodname>getPlugins()</methodname></para></listitem>
  493. <listitem><para><methodname>hasPlugin($plugin)</methodname></para></listitem>
  494. <listitem><para><methodname>removePlugin($plugin)</methodname></para></listitem>
  495. <listitem><para><methodname>clearPlugins()</methodname></para></listitem>
  496. </itemizedlist>
  497. </listitem>
  498. <listitem>
  499. <para>
  500. <emphasis>editActionInterval</emphasis> is used to group
  501. events for undo operations. By default, this value is 3
  502. seconds. The method
  503. <methodname>setEditActionInterval($interval)</methodname> may be used to
  504. set the value, while <methodname>getEditActionInterval()</methodname>
  505. will retrieve it.
  506. </para>
  507. </listitem>
  508. <listitem>
  509. <para>
  510. <emphasis>focusOnLoad</emphasis> is used to determine
  511. whether this particular editor will receive focus when the
  512. page has loaded. By default, this is <constant>FALSE</constant>. The method
  513. <methodname>setFocusOnLoad($flag)</methodname> may be used to
  514. set the value, while <methodname>getFocusOnLoad()</methodname>
  515. will retrieve it.
  516. </para>
  517. </listitem>
  518. <listitem>
  519. <para>
  520. <emphasis>height</emphasis> specifies the height of the
  521. editor; by default, this is 300px. The method
  522. <methodname>setHeight($height)</methodname> may be used to set the
  523. value, while <methodname>getHeight()</methodname> will retrieve it.
  524. </para>
  525. </listitem>
  526. <listitem>
  527. <para>
  528. <emphasis>inheritWidth</emphasis> is used to determine
  529. whether the editor will use the parent container's width or
  530. simply default to 100% width. By default, this is <constant>FALSE</constant>
  531. (i.e., it will fill the width of the window). The method
  532. <methodname>setInheritWidth($flag)</methodname> may be used to set the
  533. value, while <methodname>getInheritWidth()</methodname> will retrieve
  534. it.
  535. </para>
  536. </listitem>
  537. <listitem>
  538. <para>
  539. <emphasis>minHeight</emphasis> indicates the minimum height
  540. of the editor; by default, this is 1em. The method
  541. <methodname>setMinHeight($height)</methodname> may be used to set the
  542. value, while <methodname>getMinHeight()</methodname> will retrieve it.
  543. </para>
  544. </listitem>
  545. <listitem>
  546. <para>
  547. <emphasis>styleSheets</emphasis> indicate what additional
  548. <acronym>CSS</acronym> stylesheets should be used to affect the display of the
  549. Editor. By default, none are registered, and it inherits the
  550. page styles. The following accessors and mutators are
  551. available for manipulating editor stylesheets:
  552. </para>
  553. <itemizedlist>
  554. <listitem>
  555. <para><methodname>addStyleSheet($styleSheet)</methodname></para>
  556. </listitem>
  557. <listitem>
  558. <para><methodname>addStyleSheets(array $styleSheets)</methodname></para>
  559. </listitem>
  560. <listitem>
  561. <para><methodname>setStyleSheets(array $styleSheets)</methodname></para>
  562. </listitem>
  563. <listitem><para><methodname>getStyleSheets()</methodname></para></listitem>
  564. <listitem>
  565. <para><methodname>hasStyleSheet($styleSheet)</methodname></para>
  566. </listitem>
  567. <listitem>
  568. <para><methodname>removeStyleSheet($styleSheet)</methodname></para>
  569. </listitem>
  570. <listitem><para><methodname>clearStyleSheets()</methodname></para></listitem>
  571. </itemizedlist>
  572. </listitem>
  573. </itemizedlist>
  574. <example id="zend.dojo.form.elements.editor.example">
  575. <title>Example Editor dijit element usage</title>
  576. <programlisting language="php"><![CDATA[
  577. $form->addElement('editor', 'content', array(
  578. 'plugins' => array('undo', '|', 'bold', 'italic'),
  579. 'editActionInterval' => 2,
  580. 'focusOnLoad' => true,
  581. 'height' => '250px',
  582. 'inheritWidth' => true,
  583. 'styleSheets' => array('/js/custom/editor.css'),
  584. ));
  585. ]]></programlisting>
  586. </example>
  587. <note>
  588. <title>Editor Dijit uses div by default</title>
  589. <para>
  590. The Editor dijit uses an <acronym>HTML</acronym> <acronym>DIV</acronym> by default.
  591. The <classname>dijit._editor.RichText</classname> documentation indicates that
  592. having it built on an HTML <acronym>TEXTAREA</acronym> can potentially have security
  593. implications.
  594. </para>
  595. <para>
  596. That said, there may be times when you want an Editor widget that can gracefully degrade to a
  597. <acronym>TEXTAREA</acronym>. In such situations, you can do so by setting the
  598. <varname>degrade</varname> property to <constant>TRUE</constant>:
  599. </para>
  600. <programlisting language="php"><![CDATA[
  601. // At instantiation:
  602. $editor = new Zend_Dojo_Form_Element_Editor('foo', array(
  603. 'degrade' => true,
  604. ));
  605. // Construction via the form:
  606. $form->addElement('editor', 'content', array(
  607. 'degrade' => true,
  608. ));
  609. // Or after instantiation:
  610. $editor->degrade = true;
  611. ]]></programlisting>
  612. </note>
  613. </sect3>
  614. <sect3 id="zend.dojo.form.elements.horizontalSlider">
  615. <title>HorizontalSlider</title>
  616. <para>
  617. HorizontalSlider provides a slider UI widget for selecting a
  618. numeric value in a range. Internally, it sets the value of a hidden
  619. element which is submitted by the form.
  620. </para>
  621. <para>
  622. HorizontalSlider derives from the <link
  623. linkend="zend.dojo.form.elements.slider">abstract Slider dijit
  624. element</link>. Additionally, it has a variety of methods for
  625. setting and configuring slider rules and rule labels.
  626. </para>
  627. <itemizedlist>
  628. <listitem>
  629. <para>
  630. <methodname>setTopDecorationDijit($dijit)</methodname> and
  631. <methodname>setBottomDecorationDijit($dijit)</methodname>: set the name
  632. of the dijit to use for either the top or bottom of the
  633. slider. This should not include the "dijit.form." prefix,
  634. but rather only the final name -- one of "HorizontalRule"
  635. or "HorizontalRuleLabels".
  636. </para>
  637. </listitem>
  638. <listitem>
  639. <para>
  640. <methodname>setTopDecorationContainer($container)</methodname> and
  641. <methodname>setBottomDecorationContainer($container)</methodname>:
  642. specify the name to use for the container element of the
  643. rules; e.g. 'topRule', 'topContainer', etc.
  644. </para>
  645. </listitem>
  646. <listitem>
  647. <para>
  648. <methodname>setTopDecorationLabels(array $labels)</methodname> and
  649. <methodname>setBottomDecorationLabels(array $labels)</methodname>: set
  650. the labels to use for one of the RuleLabels dijit types.
  651. These should be an indexed array; specify a single empty
  652. space to skip a given label position (such as the beginning
  653. or end).
  654. </para>
  655. </listitem>
  656. <listitem>
  657. <para>
  658. <methodname>setTopDecorationParams(array $params)</methodname> and
  659. <methodname>setBottomDecorationParams(array $params)</methodname>:
  660. dijit parameters to use when configuring the given Rule or
  661. RuleLabels dijit.
  662. </para>
  663. </listitem>
  664. <listitem>
  665. <para>
  666. <methodname>setTopDecorationAttribs(array $attribs)</methodname> and
  667. <methodname>setBottomDecorationAttribs(array $attribs)</methodname>:
  668. HTML attributes to specify for the given Rule or RuleLabels
  669. HTML element container.
  670. </para>
  671. </listitem>
  672. <listitem>
  673. <para>
  674. <methodname>getTopDecoration()</methodname> and
  675. <methodname>getBottomDecoration()</methodname>: retrieve all metadata
  676. for a given Rule or RuleLabels definition, as provided by
  677. the above mutators.
  678. </para>
  679. </listitem>
  680. </itemizedlist>
  681. <example id="zend.dojo.form.elements.horizontalSlider.example">
  682. <title>Example HorizontalSlider dijit element usage</title>
  683. <para>
  684. The following will create a horizontal slider selection with
  685. integer values ranging from -10 to 10. The top will have labels
  686. at the 20%, 40%, 60%, and 80% marks. The bottom will have rules
  687. at 0, 50%, and 100%. Each time the value is changed, the hidden
  688. element storing the value will be updated.
  689. </para>
  690. <programlisting language="php"><![CDATA[
  691. $form->addElement(
  692. 'HorizontalSlider',
  693. 'horizontal',
  694. array(
  695. 'label' => 'HorizontalSlider',
  696. 'value' => 5,
  697. 'minimum' => -10,
  698. 'maximum' => 10,
  699. 'discreteValues' => 11,
  700. 'intermediateChanges' => true,
  701. 'showButtons' => true,
  702. 'topDecorationDijit' => 'HorizontalRuleLabels',
  703. 'topDecorationContainer' => 'topContainer',
  704. 'topDecorationLabels' => array(
  705. ' ',
  706. '20%',
  707. '40%',
  708. '60%',
  709. '80%',
  710. ' ',
  711. ),
  712. 'topDecorationParams' => array(
  713. 'container' => array(
  714. 'style' => 'height:1.2em; font-size=75%;color:gray;',
  715. ),
  716. 'list' => array(
  717. 'style' => 'height:1em; font-size=75%;color:gray;',
  718. ),
  719. ),
  720. 'bottomDecorationDijit' => 'HorizontalRule',
  721. 'bottomDecorationContainer' => 'bottomContainer',
  722. 'bottomDecorationLabels' => array(
  723. '0%',
  724. '50%',
  725. '100%',
  726. ),
  727. 'bottomDecorationParams' => array(
  728. 'list' => array(
  729. 'style' => 'height:1em; font-size=75%;color:gray;',
  730. ),
  731. ),
  732. )
  733. );
  734. ]]></programlisting>
  735. </example>
  736. </sect3>
  737. <sect3 id="zend.dojo.form.elements.numberSpinner">
  738. <title>NumberSpinner</title>
  739. <para>
  740. A number spinner is a text element for entering numeric values; it
  741. also includes elements for incrementing and decrementing the value
  742. by a set amount.
  743. </para>
  744. <para>
  745. The following methods are available:
  746. </para>
  747. <itemizedlist>
  748. <listitem><para>
  749. <methodname>setDefaultTimeout($timeout)</methodname> and
  750. <methodname>getDefaultTimeout()</methodname>: set and retrieve the default
  751. timeout, in milliseconds, between when the button is held
  752. pressed and the value is changed.
  753. </para></listitem>
  754. <listitem><para>
  755. <methodname>setTimeoutChangeRate($rate)</methodname> and
  756. <methodname>getTimeoutChangeRate()</methodname>: set and retrieve the
  757. rate, in milliseconds, at which changes will be made when a
  758. button is held pressed.
  759. </para></listitem>
  760. <listitem><para>
  761. <methodname>setLargeDelta($delta)</methodname> and
  762. <methodname>getLargeDelta()</methodname>: set and retrieve the amount by
  763. which the numeric value should change when a button is held
  764. pressed.
  765. </para></listitem>
  766. <listitem><para>
  767. <methodname>setSmallDelta($delta)</methodname> and
  768. <methodname>getSmallDelta()</methodname>: set and retrieve the delta by
  769. which the number should change when a button is pressed once.
  770. </para></listitem>
  771. <listitem><para>
  772. <methodname>setIntermediateChanges($flag)</methodname> and
  773. <methodname>getIntermediateChanges()</methodname>: set and retrieve the
  774. flag indicating whether or not each value change should be
  775. shown when a button is held pressed.
  776. </para></listitem>
  777. <listitem><para>
  778. <methodname>setRangeMessage($message)</methodname> and
  779. <methodname>getRangeMessage()</methodname>: set and retrieve the message
  780. indicating the range of values available.
  781. </para></listitem>
  782. <listitem><para>
  783. <methodname>setMin($value)</methodname> and <methodname>getMin()</methodname>: set
  784. and retrieve the minimum value possible.
  785. </para></listitem>
  786. <listitem><para>
  787. <methodname>setMax($value)</methodname> and <methodname>getMax()</methodname>: set
  788. and retrieve the maximum value possible.
  789. </para></listitem>
  790. </itemizedlist>
  791. <example id="zend.dojo.form.elements.numberSpinner.example">
  792. <title>Example NumberSpinner dijit element usage</title>
  793. <programlisting language="php"><![CDATA[
  794. $form->addElement(
  795. 'NumberSpinner',
  796. 'foo',
  797. array(
  798. 'value' => '7',
  799. 'label' => 'NumberSpinner',
  800. 'smallDelta' => 5,
  801. 'largeDelta' => 25,
  802. 'defaultTimeout' => 500,
  803. 'timeoutChangeRate' => 100,
  804. 'min' => 9,
  805. 'max' => 1550,
  806. 'places' => 0,
  807. 'maxlength' => 20,
  808. )
  809. );
  810. ]]></programlisting>
  811. </example>
  812. </sect3>
  813. <sect3 id="zend.dojo.form.elements.numberTextBox">
  814. <title>NumberTextBox</title>
  815. <para>
  816. A number text box is a text element for entering numeric values;
  817. unlike NumberSpinner, numbers are entered manually. Validations and
  818. constraints can be provided to ensure the number stays in a
  819. particular range or format.
  820. </para>
  821. <para>
  822. Internally, NumberTextBox derives from <link
  823. linkend="zend.dojo.form.elements.validationTextBox">ValidationTextBox</link>
  824. and <link linkend="zend.dojo.form.elements.textBox">TextBox</link>;
  825. all methods available to those classes are available. In addition,
  826. the following methods can be used to set individual constraints:
  827. </para>
  828. <itemizedlist>
  829. <listitem><para>
  830. <methodname>setLocale($locale)</methodname> and
  831. <methodname>getLocale()</methodname>: specify and retrieve a specific or alternate
  832. locale to use with this dijit.
  833. </para></listitem>
  834. <listitem><para>
  835. <methodname>setPattern($pattern)</methodname> and
  836. <methodname>getPattern()</methodname>: set and retrieve a <ulink
  837. url="http://www.unicode.org/reports/tr35/#Number_Format_Patterns">number
  838. pattern format</ulink> to use to format the number.
  839. </para></listitem>
  840. <listitem><para>
  841. <methodname>setType($type)</methodname> and <methodname>getType()</methodname>: set
  842. and retrieve the numeric format type to use (should be one of
  843. 'decimal', 'percent', or 'currency').
  844. </para></listitem>
  845. <listitem><para>
  846. <methodname>setPlaces($places)</methodname> and
  847. <methodname>getPlaces()</methodname>: set and retrieve the number of decimal places
  848. to support.
  849. </para></listitem>
  850. <listitem><para>
  851. <methodname>setStrict($flag)</methodname> and <methodname>getStrict()</methodname>:
  852. set and retrieve the value of the strict flag, which indicates how
  853. much leniency is allowed in relation to whitespace and
  854. non-numeric characters.
  855. </para></listitem>
  856. </itemizedlist>
  857. <example id="zend.dojo.form.elements.numberTextBox.example">
  858. <title>Example NumberTextBox dijit element usage</title>
  859. <programlisting language="php"><![CDATA[
  860. $form->addElement(
  861. 'NumberTextBox',
  862. 'elevation',
  863. array(
  864. 'label' => 'NumberTextBox',
  865. 'required' => true,
  866. 'invalidMessage' => 'Invalid elevation.',
  867. 'places' => 0,
  868. 'constraints' => array(
  869. 'min' => -20000,
  870. 'max' => 20000,
  871. ),
  872. )
  873. );
  874. ]]></programlisting>
  875. </example>
  876. </sect3>
  877. <sect3 id="zend.dojo.form.elements.passwordTextBox">
  878. <title>PasswordTextBox</title>
  879. <para>
  880. PasswordTextBox is simply a ValidationTextBox that is tied to a
  881. password input; its sole purpose is to allow for a dijit-themed text
  882. entry for passwords that also provides client-side validation.
  883. </para>
  884. <para>
  885. Internally, PasswordTextBox derives from <link
  886. linkend="zend.dojo.form.elements.validationTextBox">ValidationTextBox</link>
  887. and <link linkend="zend.dojo.form.elements.textBox">TextBox</link>;
  888. all methods available to those classes are available.
  889. </para>
  890. <example id="zend.dojo.form.elements.passwordTextBox.example">
  891. <title>Example PasswordTextBox dijit element usage</title>
  892. <programlisting language="php"><![CDATA[
  893. $form->addElement(
  894. 'PasswordTextBox',
  895. 'password',
  896. array(
  897. 'label' => 'Password',
  898. 'required' => true,
  899. 'trim' => true,
  900. 'lowercase' => true,
  901. 'regExp' => '^[a-z0-9]{6,}$',
  902. 'invalidMessage' => 'Invalid password; ' .
  903. 'must be at least 6 alphanumeric characters',
  904. )
  905. );
  906. ]]></programlisting>
  907. </example>
  908. </sect3>
  909. <sect3 id="zend.dojo.form.elements.radioButton">
  910. <title>RadioButton</title>
  911. <para>
  912. RadioButton wraps standard radio input elements to provide a
  913. consistent look and feel with other dojo dijits.
  914. </para>
  915. <para>
  916. RadioButton extends from DijitMulti, which
  917. allows you to specify select options via the
  918. <methodname>setMultiOptions()</methodname> and <methodname>setMultiOption()</methodname>
  919. methods.
  920. </para>
  921. <para>
  922. By default, this element registers an <classname>InArray</classname> validator
  923. which validates against the array keys of registered options. You
  924. can disable this behavior by either calling
  925. <methodname>setRegisterInArrayValidator(false)</methodname>, or by passing a
  926. <constant>FALSE</constant> value to the <property>registerInArrayValidator</property>
  927. configuration key.
  928. </para>
  929. <example id="zend.dojo.form.elements.radioButton.example">
  930. <title>Example RadioButton dijit element usage</title>
  931. <programlisting language="php"><![CDATA[
  932. $form->addElement(
  933. 'RadioButton',
  934. 'foo',
  935. array(
  936. 'label' => 'RadioButton',
  937. 'multiOptions' => array(
  938. 'foo' => 'Foo',
  939. 'bar' => 'Bar',
  940. 'baz' => 'Baz',
  941. ),
  942. 'value' => 'bar',
  943. )
  944. );
  945. ]]></programlisting>
  946. </example>
  947. </sect3>
  948. <sect3 id="zend.dojo.form.elements.simpletextarea">
  949. <title>SimpleTextarea</title>
  950. <para>
  951. SimpleTextarea acts primarily like a standard HTML textarea. However, it
  952. does not support either the rows or cols settings. Instead, the
  953. textarea width should be specified using standard <acronym>CSS</acronym> measurements.
  954. Unlike Textarea, it will not grow automatically
  955. </para>
  956. <example id="zend.dojo.form.elements.simpletextarea.example">
  957. <title>Example SimpleTextarea dijit element usage</title>
  958. <programlisting language="php"><![CDATA[
  959. $form->addElement(
  960. 'SimpleTextarea',
  961. 'simpletextarea',
  962. array(
  963. 'label' => 'SimpleTextarea',
  964. 'required' => true,
  965. 'style' => 'width: 80em; height: 25em;',
  966. )
  967. );
  968. ]]></programlisting>
  969. </example>
  970. </sect3>
  971. <sect3 id="zend.dojo.form.elements.slider">
  972. <title>Slider abstract element</title>
  973. <para>
  974. Slider is an abstract element from which
  975. <link linkend="zend.dojo.form.elements.horizontalSlider">HorizontalSlider</link>
  976. and
  977. <link linkend="zend.dojo.form.elements.verticalSlider">VerticalSlider</link>
  978. both derive. It exposes a number of common methods for configuring
  979. your sliders, including:
  980. </para>
  981. <itemizedlist>
  982. <listitem><para>
  983. <methodname>setClickSelect($flag)</methodname> and
  984. <methodname>getClickSelect()</methodname>: set and retrieve the flag
  985. indicating whether or not clicking the slider changes the
  986. value.
  987. </para></listitem>
  988. <listitem><para>
  989. <methodname>setIntermediateChanges($flag)</methodname> and
  990. <methodname>getIntermediateChanges()</methodname>: set and retrieve the
  991. flag indicating whether or not the dijit will send a
  992. notification on each slider change event.
  993. </para></listitem>
  994. <listitem><para>
  995. <methodname>setShowButtons($flag)</methodname> and
  996. <methodname>getShowButtons()</methodname>: set and retrieve the flag
  997. indicating whether or not buttons on either end will be
  998. displayed; if so, the user can click on these to change the
  999. value of the slider.
  1000. </para></listitem>
  1001. <listitem><para>
  1002. <methodname>setDiscreteValues($value)</methodname> and
  1003. <methodname>getDiscreteValues()</methodname>: set and retrieve the number
  1004. of discrete values represented by the slider.
  1005. </para></listitem>
  1006. <listitem><para>
  1007. <methodname>setMaximum($value)</methodname> and
  1008. <methodname>getMaximum()</methodname>: set the maximum value of the slider.
  1009. </para></listitem>
  1010. <listitem><para>
  1011. <methodname>setMinimum($value)</methodname> and
  1012. <methodname>getMinimum()</methodname>: set the minimum value of the slider.
  1013. </para></listitem>
  1014. <listitem><para>
  1015. <methodname>setPageIncrement($value)</methodname> and
  1016. <methodname>getPageIncrement()</methodname>: set the amount by which the
  1017. slider will change on keyboard events.
  1018. </para></listitem>
  1019. </itemizedlist>
  1020. <para>
  1021. Example usage is provided with each concrete extending class.
  1022. </para>
  1023. </sect3>
  1024. <sect3 id="zend.dojo.form.elements.submitButton">
  1025. <title>SubmitButton</title>
  1026. <para>
  1027. While there is no Dijit named SubmitButton, we include one here to
  1028. provide a button dijit capable of submitting a form without
  1029. requiring any additional javascript bindings. It works exactly like
  1030. the <link linkend="zend.dojo.form.elements.button">Button
  1031. dijit</link>.
  1032. </para>
  1033. <example id="zend.dojo.form.elements.submitButton.example">
  1034. <title>Example SubmitButton dijit element usage</title>
  1035. <programlisting language="php"><![CDATA[
  1036. $form->addElement(
  1037. 'SubmitButton',
  1038. 'foo',
  1039. array(
  1040. 'required' => false,
  1041. 'ignore' => true,
  1042. 'label' => 'Submit Button!',
  1043. )
  1044. );
  1045. ]]></programlisting>
  1046. </example>
  1047. </sect3>
  1048. <sect3 id="zend.dojo.form.elements.textBox">
  1049. <title>TextBox</title>
  1050. <para>
  1051. TextBox is included primarily to provide a text input with
  1052. consistent look-and-feel to the other dijits. However, it also
  1053. includes some minor filtering and validation capabilities,
  1054. represented in the following methods:
  1055. </para>
  1056. <itemizedlist>
  1057. <listitem><para>
  1058. <methodname>setLowercase($flag)</methodname> and
  1059. <methodname>getLowercase()</methodname>: set and retrieve the flag
  1060. indicating whether or not input should be cast to lowercase.
  1061. </para></listitem>
  1062. <listitem><para>
  1063. <methodname>setPropercase($flag)</methodname> and
  1064. <methodname>getPropercase()</methodname>: set and retrieve the flag
  1065. indicating whether or not the input should be cast to Proper
  1066. Case.
  1067. </para></listitem>
  1068. <listitem><para>
  1069. <methodname>setUppercase($flag)</methodname> and
  1070. <methodname>getUppercase()</methodname>: set and retrieve
  1071. the flag indicating whether or not the input should be cast to UPPERCASE.
  1072. </para></listitem>
  1073. <listitem><para>
  1074. <methodname>setTrim($flag)</methodname> and <methodname>getTrim()</methodname>: set
  1075. and retrieve the flag indicating whether or not leading or trailing
  1076. whitespace should be stripped.
  1077. </para></listitem>
  1078. <listitem><para>
  1079. <methodname>setMaxLength($length)</methodname> and
  1080. <methodname>getMaxLength()</methodname>: set and retrieve the maximum
  1081. length of input.
  1082. </para></listitem>
  1083. </itemizedlist>
  1084. <example id="zend.dojo.form.elements.textBox.example">
  1085. <title>Example TextBox dijit element usage</title>
  1086. <programlisting language="php"><![CDATA[
  1087. $form->addElement(
  1088. 'TextBox',
  1089. 'foo',
  1090. array(
  1091. 'value' => 'some text',
  1092. 'label' => 'TextBox',
  1093. 'trim' => true,
  1094. 'propercase' => true,
  1095. )
  1096. );
  1097. ]]></programlisting>
  1098. </example>
  1099. </sect3>
  1100. <sect3 id="zend.dojo.form.elements.textarea">
  1101. <title>Textarea</title>
  1102. <para>
  1103. Textarea acts primarily like a standard HTML textarea. However, it
  1104. does not support either the rows or cols settings. Instead, the
  1105. textarea width should be specified using standard <acronym>CSS</acronym> measurements;
  1106. rows should be omitted entirely. The textarea will then grow
  1107. vertically as text is added to it.
  1108. </para>
  1109. <example id="zend.dojo.form.elements.textarea.example">
  1110. <title>Example Textarea dijit element usage</title>
  1111. <programlisting language="php"><![CDATA[
  1112. $form->addElement(
  1113. 'Textarea',
  1114. 'textarea',
  1115. array(
  1116. 'label' => 'Textarea',
  1117. 'required' => true,
  1118. 'style' => 'width: 200px;',
  1119. )
  1120. );
  1121. ]]></programlisting>
  1122. </example>
  1123. </sect3>
  1124. <sect3 id="zend.dojo.form.elements.timeTextBox">
  1125. <title>TimeTextBox</title>
  1126. <para>
  1127. TimeTextBox is a text input that provides a drop-down for selecting
  1128. a time. The drop-down may be configured to show a certain window of
  1129. time, with specified increments.
  1130. </para>
  1131. <para>
  1132. Internally, TimeTextBox derives from <link
  1133. linkend="zend.dojo.form.elements.dateTextBox">DateTextBox</link>,
  1134. <link
  1135. linkend="zend.dojo.form.elements.validationTextBox">ValidationTextBox</link>
  1136. and <link linkend="zend.dojo.form.elements.textBox">TextBox</link>;
  1137. all methods available to those classes are available. In addition,
  1138. the following methods can be used to set individual constraints:
  1139. </para>
  1140. <itemizedlist>
  1141. <listitem><para>
  1142. <methodname>setTimePattern($pattern)</methodname> and
  1143. <methodname>getTimePattern()</methodname>: set and retrieve the <ulink
  1144. url="http://www.unicode.org/reports/tr35/#Date_Format_Patterns">unicode
  1145. time format pattern</ulink> for formatting the time.
  1146. </para></listitem>
  1147. <listitem><para>
  1148. <methodname>setClickableIncrement($format)</methodname> and
  1149. <methodname>getClickableIncrement()</methodname>: set the <ulink
  1150. url="http://en.wikipedia.org/wiki/ISO_8601">ISO-8601</ulink>
  1151. string representing the amount by which every clickable element
  1152. in the time picker increases.
  1153. </para></listitem>
  1154. <listitem><para>
  1155. <methodname>setVisibleIncrement($format)</methodname> and
  1156. <methodname>getVisibleIncrement()</methodname>: set the increment visible
  1157. in the time chooser; must follow ISO-8601 formats.
  1158. </para></listitem>
  1159. <listitem><para>
  1160. <methodname>setVisibleRange($format)</methodname> and
  1161. <methodname>getVisibleRange()</methodname>: set and retrieve the range of
  1162. time visible in the time chooser at any given moment; must
  1163. follow ISO-8601 formats.
  1164. </para></listitem>
  1165. </itemizedlist>
  1166. <example id="zend.dojo.form.elements.timeTextBox.example">
  1167. <title>Example TimeTextBox dijit element usage</title>
  1168. <para>
  1169. The following will create a TimeTextBox that displays 2 hours
  1170. at a time, with increments of 10 minutes.
  1171. </para>
  1172. <programlisting language="php"><![CDATA[
  1173. $form->addElement(
  1174. 'TimeTextBox',
  1175. 'foo',
  1176. array(
  1177. 'label' => 'TimeTextBox',
  1178. 'required' => true,
  1179. 'visibleRange' => 'T04:00:00',
  1180. 'visibleIncrement' => 'T00:10:00',
  1181. 'clickableIncrement' => 'T00:10:00',
  1182. )
  1183. );
  1184. ]]></programlisting>
  1185. </example>
  1186. </sect3>
  1187. <sect3 id="zend.dojo.form.elements.validationTextBox">
  1188. <title>ValidationTextBox</title>
  1189. <para>
  1190. ValidationTextBox provides the ability to add validations and constraints to a text
  1191. input. Internally, it derives from <link
  1192. linkend="zend.dojo.form.elements.textBox">TextBox</link>, and adds the following
  1193. accessors and mutators for manipulating dijit parameters:
  1194. </para>
  1195. <itemizedlist>
  1196. <listitem><para>
  1197. <methodname>setInvalidMessage($message)</methodname> and
  1198. <methodname>getInvalidMessage()</methodname>: set and retrieve the tooltip
  1199. message to display when the value does not validate.
  1200. </para></listitem>
  1201. <listitem><para>
  1202. <methodname>setPromptMessage($message)</methodname> and
  1203. <methodname>getPromptMessage()</methodname>: set and retrieve the tooltip
  1204. message to display for element usage.
  1205. </para></listitem>
  1206. <listitem><para>
  1207. <methodname>setRegExp($regexp)</methodname> and
  1208. <methodname>getRegExp()</methodname>: set and retrieve the regular expression to
  1209. use for validating the element. The regular expression does not need boundaries
  1210. (unlike <acronym>PHP</acronym>'s preg* family of functions).
  1211. </para></listitem>
  1212. <listitem><para>
  1213. <methodname>setConstraint($key, $value)</methodname> and
  1214. <methodname>getConstraint($key)</methodname>: set and retrieve additional
  1215. constraints to use when validating the element; used primarily
  1216. with subclasses. Constraints are stored in the 'constraints'
  1217. key of the dijit parameters.
  1218. </para></listitem>
  1219. <listitem><para>
  1220. <methodname>setConstraints(array $constraints)</methodname> and
  1221. <methodname>getConstraints()</methodname>: set and retrieve individual
  1222. constraints to use when validating the element; used primarily
  1223. with subclasses.
  1224. </para></listitem>
  1225. <listitem><para>
  1226. <methodname>hasConstraint($key)</methodname>: test whether a given
  1227. constraint exists.
  1228. </para></listitem>
  1229. <listitem><para>
  1230. <methodname>removeConstraint($key)</methodname> and
  1231. <methodname>clearConstraints()</methodname>: remove an individual or all
  1232. constraints for the element.
  1233. </para></listitem>
  1234. </itemizedlist>
  1235. <example id="zend.dojo.form.elements.validationTextBox.example">
  1236. <title>Example ValidationTextBox dijit element usage</title>
  1237. <para>
  1238. The following will create a ValidationTextBox that requires a
  1239. single string consisting solely of word characters (i.e., no
  1240. spaces, most punctuation is invalid).
  1241. </para>
  1242. <programlisting language="php"><![CDATA[
  1243. $form->addElement(
  1244. 'ValidationTextBox',
  1245. 'foo',
  1246. array(
  1247. 'label' => 'ValidationTextBox',
  1248. 'required' => true,
  1249. 'regExp' => '[\w]+',
  1250. 'invalidMessage' => 'Invalid non-space text.',
  1251. )
  1252. );
  1253. ]]></programlisting>
  1254. </example>
  1255. </sect3>
  1256. <sect3 id="zend.dojo.form.elements.verticalSlider">
  1257. <title>VerticalSlider</title>
  1258. <para>
  1259. VerticalSlider is the sibling of <link
  1260. linkend="zend.dojo.form.elements.horizontalSlider">HorizontalSlider</link>,
  1261. and operates in every way like that element. The only real
  1262. difference is that the 'top*' and 'bottom*' methods are replaced by
  1263. 'left*' and 'right*', and instead of using HorizontalRule and
  1264. HorizontalRuleLabels, VerticalRule and VerticalRuleLabels should be
  1265. used.
  1266. </para>
  1267. <example id="zend.dojo.form.elements.verticalSlider.example">
  1268. <title>Example VerticalSlider dijit element usage</title>
  1269. <para>
  1270. The following will create a vertical slider selection with
  1271. integer values ranging from -10 to 10. The left will have labels
  1272. at the 20%, 40%, 60%, and 80% marks. The right will have rules
  1273. at 0, 50%, and 100%. Each time the value is changed, the hidden
  1274. element storing the value will be updated.
  1275. </para>
  1276. <programlisting language="php"><![CDATA[
  1277. $form->addElement(
  1278. 'VerticalSlider',
  1279. 'foo',
  1280. array(
  1281. 'label' => 'VerticalSlider',
  1282. 'value' => 5,
  1283. 'style' => 'height: 200px; width: 3em;',
  1284. 'minimum' => -10,
  1285. 'maximum' => 10,
  1286. 'discreteValues' => 11,
  1287. 'intermediateChanges' => true,
  1288. 'showButtons' => true,
  1289. 'leftDecorationDijit' => 'VerticalRuleLabels',
  1290. 'leftDecorationContainer' => 'leftContainer',
  1291. 'leftDecorationLabels' => array(
  1292. ' ',
  1293. '20%',
  1294. '40%',
  1295. '60%',
  1296. '80%',
  1297. ' ',
  1298. ),
  1299. 'rightDecorationDijit' => 'VerticalRule',
  1300. 'rightDecorationContainer' => 'rightContainer',
  1301. 'rightDecorationLabels' => array(
  1302. '0%',
  1303. '50%',
  1304. '100%',
  1305. ),
  1306. )
  1307. );
  1308. ]]></programlisting>
  1309. </example>
  1310. </sect3>
  1311. </sect2>
  1312. <!--
  1313. vim:se ts=4 sw=4 et:
  1314. -->