Zend_Dojo-Form-Elements.xml 57 KB

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