2
0

Zend_Dojo-Form-Elements.xml 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454
  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. <code>setDijitParam($key, $value)</code>: set a single dijit
  13. parameter. If the dijit parameter already exists, it will be
  14. overwritten.
  15. </para></listitem>
  16. <listitem><para>
  17. <code>setDijitParams(array $params)</code>: set several dijit
  18. parameters at once. Any passed parameters matching those
  19. already present will overwrite.
  20. </para></listitem>
  21. <listitem><para>
  22. <code>hasDijitParam($key)</code>: If a given dijit parameter
  23. is defined and present, return TRUE, otherwise return FALSE.
  24. </para></listitem>
  25. <listitem><para>
  26. <code>getDijitParam($key)</code>: retrieve the given dijit
  27. parameter. If not available, a null value is returned.
  28. </para></listitem>
  29. <listitem><para>
  30. <code>getDijitParams()</code>: retrieve all dijit parameters.
  31. </para></listitem>
  32. <listitem><para>
  33. <code>removeDijitParam($key)</code>: remove the given dijit
  34. parameter.
  35. </para></listitem>
  36. <listitem><para>
  37. <code>clearDijitParams()</code>: 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. <code>getLabel()</code> 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. <code>isChecked()</code> 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. <code>setCheckedValue($value)</code>: set the value to use when
  124. the element is checked.
  125. </para></listitem>
  126. <listitem><para>
  127. <code>getCheckedValue()</code>: get the value of the item to
  128. use when checked.
  129. </para></listitem>
  130. <listitem><para>
  131. <code>setUncheckedValue($value)</code>: set the value of the
  132. item to use when it is unchecked.
  133. </para></listitem>
  134. <listitem><para>
  135. <code>getUncheckedValue()</code>: get the value of the item to
  136. use when it is unchecked.
  137. </para></listitem>
  138. <listitem><para>
  139. <code>setChecked($flag)</code>: mark the element as checked or
  140. unchecked.
  141. </para></listitem>
  142. <listitem><para>
  143. <code>isChecked()</code>: 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. <code>setMultiOptions()</code> and <code>setMultiOption()</code>
  188. methods. In addition, the following methods are available:
  189. </para>
  190. <itemizedlist>
  191. <listitem><para>
  192. <code>getStoreInfo()</code>: 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. <code>setStoreId($identifier)</code>: 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. <code>getStoreId()</code>: retrieve the store identifier
  203. variable name.
  204. </para></listitem>
  205. <listitem><para>
  206. <code>setStoreType($dojoType)</code>: set the datastore class
  207. to use; e.g., "dojo.data.ItemFileReadStore".
  208. </para></listitem>
  209. <listitem><para>
  210. <code>getStoreType()</code>: get the dojo datastore class to
  211. use.
  212. </para></listitem>
  213. <listitem><para>
  214. <code>setStoreParams(array $params)</code>: 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. <code>getStoreParams()</code>: get any datastore parameters
  222. currently set; if none, an empty array is returned.
  223. </para></listitem>
  224. <listitem><para>
  225. <code>setAutocomplete($flag)</code>: 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. <code>getAutocomplete()</code>: 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. <code>setRegisterInArrayValidator(false)</code>, 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. <code>setCurrency($currency)</code>: 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. <code>getCurrency()</code>: retrieve the current currency type.
  315. </para></listitem>
  316. <listitem><para>
  317. <code>setSymbol($symbol)</code>: 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. <code>getSymbol()</code>: get the current currency symbol.
  323. </para></listitem>
  324. <listitem><para>
  325. <code>setFractional($flag)</code>: set whether or not the
  326. currency should allow for fractional values.
  327. </para></listitem>
  328. <listitem><para>
  329. <code>getFractional()</code>: 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. <code>setAmPm($flag)</code> and <code>getAmPm()</code>: Whether
  367. or not to use AM/PM strings in times.
  368. </para></listitem>
  369. <listitem><para>
  370. <code>setStrict($flag)</code> and <code>getStrict()</code>:
  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. <code>setLocale($locale)</code> and <code>getLocale()</code>:
  377. Set and retrieve the locale to use with this specific element.
  378. </para></listitem>
  379. <listitem><para>
  380. <code>setDatePattern($pattern)</code> and
  381. <code>getDatePattern()</code>: provide and retrieve the <ulink
  382. url="http://www.unicode.org/reports/tr35/#Date_Format_Patterns">unicode
  383. date format pattern</ulink> for formatting the date.
  384. </para></listitem>
  385. <listitem><para>
  386. <code>setFormatLength($formatLength)</code> and
  387. <code>getFormatLength()</code>: provide and retrieve the format
  388. length type to use; should be one of "long", "short", "medium"
  389. or "full".
  390. </para></listitem>
  391. <listitem><para>
  392. <code>setSelector($selector)</code> and
  393. <code>getSelector()</code>: provide and retrieve the style of
  394. selector; should be either "date" or "time".
  395. </para></listitem>
  396. </itemizedlist>
  397. <example id="zend.dojo.form.elements.dateTextBox.example">
  398. <title>Example DateTextBox dijit element usage</title>
  399. <programlisting language="php"><![CDATA[
  400. $form->addElement(
  401. 'DateTextBox',
  402. 'foo',
  403. array(
  404. 'label' => 'Date:',
  405. 'required' => true,
  406. 'invalidMessage' => 'Invalid date specified.',
  407. 'formatLength' => 'long',
  408. )
  409. );
  410. ]]></programlisting>
  411. </example>
  412. </sect3>
  413. <sect3 id="zend.dojo.form.elements.editor">
  414. <title>Editor</title>
  415. <para>
  416. Editor provides a WYSIWYG editor that can be used to both create and
  417. edit rich HTML content. dijit.Editor is pluggable and may be
  418. extended with custom plugins if desired; see <ulink
  419. url="http://dojotoolkit.org/book/dojo-book-0-9/part-2-dijit/advanced-editing-and-display/editor-rich-text">the
  420. dijit.Editor documentation</ulink> for more details.
  421. </para>
  422. <para>
  423. The Editor form element provides a number of accessors and mutators
  424. for manipulating various dijit parameters, as follows:
  425. </para>
  426. <itemizedlist>
  427. <listitem>
  428. <para>
  429. <emphasis>captureEvents</emphasis> are events that connect
  430. to the editing area itself. The following accessors and
  431. mutators are available for manipulating capture events:
  432. </para>
  433. <itemizedlist>
  434. <listitem><para><code>addCaptureEvent($event)</code></para></listitem>
  435. <listitem><para><code>addCaptureEvents(array $events)</code></para></listitem>
  436. <listitem><para><code>setCaptureEvents(array $events)</code></para></listitem>
  437. <listitem><para><code>getCaptureEvents()</code></para></listitem>
  438. <listitem><para><code>hasCaptureEvent($event)</code></para></listitem>
  439. <listitem><para><code>removeCaptureEvent($event)</code></para></listitem>
  440. <listitem><para><code>clearCaptureEvents()</code></para></listitem>
  441. </itemizedlist>
  442. </listitem>
  443. <listitem>
  444. <para>
  445. <emphasis>events</emphasis> are standard DOM events, such as
  446. onClick, onKeyUp, etc. The following accessors and mutators
  447. are available for manipulating events:
  448. </para>
  449. <itemizedlist>
  450. <listitem><para><code>addEvent($event)</code></para></listitem>
  451. <listitem><para><code>addEvents(array $events)</code></para></listitem>
  452. <listitem><para><code>setEvents(array $events)</code></para></listitem>
  453. <listitem><para><code>getEvents()</code></para></listitem>
  454. <listitem><para><code>hasEvent($event)</code></para></listitem>
  455. <listitem><para><code>removeEvent($event)</code></para></listitem>
  456. <listitem><para><code>clearEvents()</code></para></listitem>
  457. </itemizedlist>
  458. </listitem>
  459. <listitem>
  460. <para>
  461. <emphasis>plugins</emphasis> add functionality to the
  462. Editor -- additional tools for the toolbar, additional
  463. styles to allow, etc. The following accessors and mutators
  464. are available for manipulating plugins:
  465. </para>
  466. <itemizedlist>
  467. <listitem><para><code>addPlugin($plugin)</code></para></listitem>
  468. <listitem><para><code>addPlugins(array $plugins)</code></para></listitem>
  469. <listitem><para><code>setPlugins(array $plugins)</code></para></listitem>
  470. <listitem><para><code>getPlugins()</code></para></listitem>
  471. <listitem><para><code>hasPlugin($plugin)</code></para></listitem>
  472. <listitem><para><code>removePlugin($plugin)</code></para></listitem>
  473. <listitem><para><code>clearPlugins()</code></para></listitem>
  474. </itemizedlist>
  475. </listitem>
  476. <listitem>
  477. <para>
  478. <emphasis>editActionInterval</emphasis> is used to group
  479. events for undo operations. By default, this value is 3
  480. seconds. The method
  481. <code>setEditActionInterval($interval)</code> may be used to
  482. set the value, while <code>getEditActionInterval()</code>
  483. will retrieve it.
  484. </para>
  485. </listitem>
  486. <listitem>
  487. <para>
  488. <emphasis>focusOnLoad</emphasis> is used to determine
  489. whether this particular editor will receive focus when the
  490. page has loaded. By default, this is false. The method
  491. <code>setFocusOnLoad($flag)</code> may be used to
  492. set the value, while <code>getFocusOnLoad()</code>
  493. will retrieve it.
  494. </para>
  495. </listitem>
  496. <listitem>
  497. <para>
  498. <emphasis>height</emphasis> specifies the height of the
  499. editor; by default, this is 300px. The method
  500. <code>setHeight($height)</code> may be used to set the
  501. value, while <code>getHeight()</code> will retrieve it.
  502. </para>
  503. </listitem>
  504. <listitem>
  505. <para>
  506. <emphasis>inheritWidth</emphasis> is used to determine
  507. whether the editor will use the parent container's width or
  508. simply default to 100% width. By default, this is false
  509. (i.e., it will fill the width of the window). The method
  510. <code>setInheritWidth($flag)</code> may be used to set the
  511. value, while <code>getInheritWidth()</code> will retrieve
  512. it.
  513. </para>
  514. </listitem>
  515. <listitem>
  516. <para>
  517. <emphasis>minHeight</emphasis> indicates the minimum height
  518. of the editor; by default, this is 1em. The method
  519. <code>setMinHeight($height)</code> may be used to set the
  520. value, while <code>getMinHeight()</code> will retrieve it.
  521. </para>
  522. </listitem>
  523. <listitem>
  524. <para>
  525. <emphasis>styleSheets</emphasis> indicate what additional
  526. CSS stylesheets should be used to affect the display of the
  527. Editor. By default, none are registered, and it inherits the
  528. page styles. The following accessors and mutators are
  529. available for manipulating editor stylesheets:
  530. </para>
  531. <itemizedlist>
  532. <listitem><para><code>addStyleSheet($styleSheet)</code></para></listitem>
  533. <listitem>
  534. <para><code>addStyleSheets(array $styleSheets)</code></para>
  535. </listitem>
  536. <listitem>
  537. <para><code>setStyleSheets(array $styleSheets)</code></para>
  538. </listitem>
  539. <listitem><para><code>getStyleSheets()</code></para></listitem>
  540. <listitem><para><code>hasStyleSheet($styleSheet)</code></para></listitem>
  541. <listitem><para><code>removeStyleSheet($styleSheet)</code></para></listitem>
  542. <listitem><para><code>clearStyleSheets()</code></para></listitem>
  543. </itemizedlist>
  544. </listitem>
  545. </itemizedlist>
  546. <example id="zend.dojo.form.elements.editor.example">
  547. <title>Example Editor dijit element usage</title>
  548. <programlisting language="php"><![CDATA[
  549. $form->addElement('editor', 'content', array(
  550. 'plugins' => array('undo', '|', 'bold', 'italic'),
  551. 'editActionInterval' => 2,
  552. 'focusOnLoad' => true,
  553. 'height' => '250px',
  554. 'inheritWidth' => true,
  555. 'styleSheets' => array('/js/custom/editor.css'),
  556. ));
  557. ]]></programlisting>
  558. </example>
  559. </sect3>
  560. <sect3 id="zend.dojo.form.elements.horizontalSlider">
  561. <title>HorizontalSlider</title>
  562. <para>
  563. HorizontalSlider provides a slider UI widget for selecting a
  564. numeric value in a range. Internally, it sets the value of a hidden
  565. element which is submitted by the form.
  566. </para>
  567. <para>
  568. HorizontalSlider derives from the <link
  569. linkend="zend.dojo.form.elements.slider">abstract Slider dijit
  570. element</link>. Additionally, it has a variety of methods for
  571. setting and configuring slider rules and rule labels.
  572. </para>
  573. <itemizedlist>
  574. <listitem>
  575. <para>
  576. <code>setTopDecorationDijit($dijit)</code> and
  577. <code>setBottomDecorationDijit($dijit)</code>: set the name
  578. of the dijit to use for either the top or bottom of the
  579. slider. This should not include the "dijit.form." prefix,
  580. but rather only the final name -- one of "HorizontalRule"
  581. or "HorizontalRuleLabels".
  582. </para>
  583. </listitem>
  584. <listitem>
  585. <para>
  586. <code>setTopDecorationContainer($container)</code> and
  587. <code>setBottomDecorationContainer($container)</code>:
  588. specify the name to use for the container element of the
  589. rules; e.g. 'topRule', 'topContainer', etc.
  590. </para>
  591. </listitem>
  592. <listitem>
  593. <para>
  594. <code>setTopDecorationLabels(array $labels)</code> and
  595. <code>setBottomDecorationLabels(array $labels)</code>: set
  596. the labels to use for one of the RuleLabels dijit types.
  597. These should be an indexed array; specify a single empty
  598. space to skip a given label position (such as the beginning
  599. or end).
  600. </para>
  601. </listitem>
  602. <listitem>
  603. <para>
  604. <code>setTopDecorationParams(array $params)</code> and
  605. <code>setBottomDecorationParams(array $params)</code>:
  606. dijit parameters to use when configuring the given Rule or
  607. RuleLabels dijit.
  608. </para>
  609. </listitem>
  610. <listitem>
  611. <para>
  612. <code>setTopDecorationAttribs(array $attribs)</code> and
  613. <code>setBottomDecorationAttribs(array $attribs)</code>:
  614. HTML attributes to specify for the given Rule or RuleLabels
  615. HTML element container.
  616. </para>
  617. </listitem>
  618. <listitem>
  619. <para>
  620. <code>getTopDecoration()</code> and
  621. <code>getBottomDecoration()</code>: retrieve all metadata
  622. for a given Rule or RuleLabels definition, as provided by
  623. the above mutators.
  624. </para>
  625. </listitem>
  626. </itemizedlist>
  627. <example id="zend.dojo.form.elements.horizontalSlider.example">
  628. <title>Example HorizontalSlider dijit element usage</title>
  629. <para>
  630. The following will create a horizontal slider selection with
  631. integer values ranging from -10 to 10. The top will have labels
  632. at the 20%, 40%, 60%, and 80% marks. The bottom will have rules
  633. at 0, 50%, and 100%. Each time the value is changed, the hidden
  634. element storing the value will be updated.
  635. </para>
  636. <programlisting language="php"><![CDATA[
  637. $form->addElement(
  638. 'HorizontalSlider',
  639. 'horizontal',
  640. array(
  641. 'label' => 'HorizontalSlider',
  642. 'value' => 5,
  643. 'minimum' => -10,
  644. 'maximum' => 10,
  645. 'discreteValues' => 11,
  646. 'intermediateChanges' => true,
  647. 'showButtons' => true,
  648. 'topDecorationDijit' => 'HorizontalRuleLabels',
  649. 'topDecorationContainer' => 'topContainer',
  650. 'topDecorationLabels' => array(
  651. ' ',
  652. '20%',
  653. '40%',
  654. '60%',
  655. '80%',
  656. ' ',
  657. ),
  658. 'topDecorationParams' => array(
  659. 'container' => array(
  660. 'style' => 'height:1.2em; font-size=75%;color:gray;',
  661. ),
  662. 'list' => array(
  663. 'style' => 'height:1em; font-size=75%;color:gray;',
  664. ),
  665. ),
  666. 'bottomDecorationDijit' => 'HorizontalRule',
  667. 'bottomDecorationContainer' => 'bottomContainer',
  668. 'bottomDecorationLabels' => array(
  669. '0%',
  670. '50%',
  671. '100%',
  672. ),
  673. 'bottomDecorationParams' => array(
  674. 'list' => array(
  675. 'style' => 'height:1em; font-size=75%;color:gray;',
  676. ),
  677. ),
  678. )
  679. );
  680. ]]></programlisting>
  681. </example>
  682. </sect3>
  683. <sect3 id="zend.dojo.form.elements.numberSpinner">
  684. <title>NumberSpinner</title>
  685. <para>
  686. A number spinner is a text element for entering numeric values; it
  687. also includes elements for incrementing and decrementing the value
  688. by a set amount.
  689. </para>
  690. <para>
  691. The following methods are available:
  692. </para>
  693. <itemizedlist>
  694. <listitem><para>
  695. <code>setDefaultTimeout($timeout)</code> and
  696. <code>getDefaultTimeout()</code>: set and retrieve the default
  697. timeout, in milliseconds, between when the button is held
  698. pressed and the value is changed.
  699. </para></listitem>
  700. <listitem><para>
  701. <code>setTimeoutChangeRate($rate)</code> and
  702. <code>getTimeoutChangeRate()</code>: set and retrieve the
  703. rate, in milliseconds, at which changes will be made when a
  704. button is held pressed.
  705. </para></listitem>
  706. <listitem><para>
  707. <code>setLargeDelta($delta)</code> and
  708. <code>getLargeDelta()</code>: set and retrieve the amount by
  709. which the numeric value should change when a button is held
  710. pressed.
  711. </para></listitem>
  712. <listitem><para>
  713. <code>setSmallDelta($delta)</code> and
  714. <code>getSmallDelta()</code>: set and retrieve the delta by
  715. which the number should change when a button is pressed once.
  716. </para></listitem>
  717. <listitem><para>
  718. <code>setIntermediateChanges($flag)</code> and
  719. <code>getIntermediateChanges()</code>: set and retrieve the
  720. flag indicating whether or not each value change should be
  721. shown when a button is held pressed.
  722. </para></listitem>
  723. <listitem><para>
  724. <code>setRangeMessage($message)</code> and
  725. <code>getRangeMessage()</code>: set and retrieve the message
  726. indicating the range of values available.
  727. </para></listitem>
  728. <listitem><para>
  729. <code>setMin($value)</code> and <code>getMin()</code>: set and
  730. retrieve the minimum value possible.
  731. </para></listitem>
  732. <listitem><para>
  733. <code>setMax($value)</code> and <code>getMax()</code>: set and
  734. retrieve the maximum value possible.
  735. </para></listitem>
  736. </itemizedlist>
  737. <example id="zend.dojo.form.elements.numberSpinner.example">
  738. <title>Example NumberSpinner dijit element usage</title>
  739. <programlisting language="php"><![CDATA[
  740. $form->addElement(
  741. 'NumberSpinner',
  742. 'foo',
  743. array(
  744. 'value' => '7',
  745. 'label' => 'NumberSpinner',
  746. 'smallDelta' => 5,
  747. 'largeDelta' => 25,
  748. 'defaultTimeout' => 500,
  749. 'timeoutChangeRate' => 100,
  750. 'min' => 9,
  751. 'max' => 1550,
  752. 'places' => 0,
  753. 'maxlength' => 20,
  754. )
  755. );
  756. ]]></programlisting>
  757. </example>
  758. </sect3>
  759. <sect3 id="zend.dojo.form.elements.numberTextBox">
  760. <title>NumberTextBox</title>
  761. <para>
  762. A number text box is a text element for entering numeric values;
  763. unlike NumberSpinner, numbers are entered manually. Validations and
  764. constraints can be provided to ensure the number stays in a
  765. particular range or format.
  766. </para>
  767. <para>
  768. Internally, NumberTextBox derives from <link
  769. linkend="zend.dojo.form.elements.validationTextBox">ValidationTextBox</link>
  770. and <link linkend="zend.dojo.form.elements.textBox">TextBox</link>;
  771. all methods available to those classes are available. In addition,
  772. the following methods can be used to set individual constraints:
  773. </para>
  774. <itemizedlist>
  775. <listitem><para>
  776. <code>setLocale($locale)</code> and <code>getLocale()</code>:
  777. specify and retrieve a specific or alternate locale to use with
  778. this dijit.
  779. </para></listitem>
  780. <listitem><para>
  781. <code>setPattern($pattern)</code> and
  782. <code>getPattern()</code>: set and retrieve a <ulink
  783. url="http://www.unicode.org/reports/tr35/#Number_Format_Patterns">number
  784. pattern format</ulink> to use to format the number.
  785. </para></listitem>
  786. <listitem><para>
  787. <code>setType($type)</code> and <code>getType()</code>: set and
  788. retrieve the numeric format type to use (should be one of
  789. 'decimal', 'percent', or 'currency').
  790. </para></listitem>
  791. <listitem><para>
  792. <code>setPlaces($places)</code> and <code>getPlaces()</code>:
  793. set and retrieve the number of decimal places to support.
  794. </para></listitem>
  795. <listitem><para>
  796. <code>setStrict($flag)</code> and <code>getStrict()</code>: set
  797. and retrieve the value of the strict flag, which indicates how
  798. much leniency is allowed in relation to whitespace and
  799. non-numeric characters.
  800. </para></listitem>
  801. </itemizedlist>
  802. <example id="zend.dojo.form.elements.numberTextBox.example">
  803. <title>Example NumberTextBox dijit element usage</title>
  804. <programlisting language="php"><![CDATA[
  805. $form->addElement(
  806. 'NumberTextBox',
  807. 'elevation',
  808. array(
  809. 'label' => 'NumberTextBox',
  810. 'required' => true,
  811. 'invalidMessage' => 'Invalid elevation.',
  812. 'places' => 0,
  813. 'constraints' => array(
  814. 'min' => -20000,
  815. 'max' => 20000,
  816. ),
  817. )
  818. );
  819. ]]></programlisting>
  820. </example>
  821. </sect3>
  822. <sect3 id="zend.dojo.form.elements.passwordTextBox">
  823. <title>PasswordTextBox</title>
  824. <para>
  825. PasswordTextBox is simply a ValidationTextBox that is tied to a
  826. password input; its sole purpose is to allow for a dijit-themed text
  827. entry for passwords that also provides client-side validation.
  828. </para>
  829. <para>
  830. Internally, PasswordTextBox derives from <link
  831. linkend="zend.dojo.form.elements.validationTextBox">ValidationTextBox</link>
  832. and <link linkend="zend.dojo.form.elements.textBox">TextBox</link>;
  833. all methods available to those classes are available.
  834. </para>
  835. <example id="zend.dojo.form.elements.passwordTextBox.example">
  836. <title>Example PasswordTextBox dijit element usage</title>
  837. <programlisting language="php"><![CDATA[
  838. $form->addElement(
  839. 'PasswordTextBox',
  840. 'password',
  841. array(
  842. 'label' => 'Password',
  843. 'required' => true,
  844. 'trim' => true,
  845. 'lowercase' => true,
  846. 'regExp' => '^[a-z0-9]{6,}$',
  847. 'invalidMessage' => 'Invalid password; ' .
  848. 'must be at least 6 alphanumeric characters',
  849. )
  850. );
  851. ]]></programlisting>
  852. </example>
  853. </sect3>
  854. <sect3 id="zend.dojo.form.elements.radioButton">
  855. <title>RadioButton</title>
  856. <para>
  857. RadioButton wraps standard radio input elements to provide a
  858. consistent look and feel with other dojo dijits.
  859. </para>
  860. <para>
  861. RadioButton extends from DijitMulti, which
  862. allows you to specify select options via the
  863. <code>setMultiOptions()</code> and <code>setMultiOption()</code>
  864. methods.
  865. </para>
  866. <para>
  867. By default, this element registers an <code>InArray</code> validator
  868. which validates against the array keys of registered options. You
  869. can disable this behavior by either calling
  870. <code>setRegisterInArrayValidator(false)</code>, or by passing a
  871. false value to the <code>registerInArrayValidator</code>
  872. configuration key.
  873. </para>
  874. <example id="zend.dojo.form.elements.radioButton.example">
  875. <title>Example RadioButton dijit element usage</title>
  876. <programlisting language="php"><![CDATA[
  877. $form->addElement(
  878. 'RadioButton',
  879. 'foo',
  880. array(
  881. 'label' => 'RadioButton',
  882. 'multiOptions' => array(
  883. 'foo' => 'Foo',
  884. 'bar' => 'Bar',
  885. 'baz' => 'Baz',
  886. ),
  887. 'value' => 'bar',
  888. )
  889. );
  890. ]]></programlisting>
  891. </example>
  892. </sect3>
  893. <sect3 id="zend.dojo.form.elements.simpletextarea">
  894. <title>SimpleTextarea</title>
  895. <para>
  896. SimpleTextarea acts primarily like a standard HTML textarea. However, it
  897. does not support either the rows or cols settings. Instead, the
  898. textarea width should be specified using standard CSS measurements.
  899. Unlike Textarea, it will not grow automatically
  900. </para>
  901. <example id="zend.dojo.form.elements.simpletextarea.example">
  902. <title>Example SimpleTextarea dijit element usage</title>
  903. <programlisting language="php"><![CDATA[
  904. $form->addElement(
  905. 'SimpleTextarea',
  906. 'simpletextarea',
  907. array(
  908. 'label' => 'SimpleTextarea',
  909. 'required' => true,
  910. 'style' => 'width: 80em; height: 25em;',
  911. )
  912. );
  913. ]]></programlisting>
  914. </example>
  915. </sect3>
  916. <sect3 id="zend.dojo.form.elements.slider">
  917. <title>Slider abstract element</title>
  918. <para>
  919. Slider is an abstract element from which
  920. <link linkend="zend.dojo.form.elements.horizontalSlider">HorizontalSlider</link>
  921. and
  922. <link linkend="zend.dojo.form.elements.verticalSlider">VerticalSlider</link>
  923. both derive. It exposes a number of common methods for configuring
  924. your sliders, including:
  925. </para>
  926. <itemizedlist>
  927. <listitem><para>
  928. <code>setClickSelect($flag)</code> and
  929. <code>getClickSelect()</code>: set and retrieve the flag
  930. indicating whether or not clicking the slider changes the
  931. value.
  932. </para></listitem>
  933. <listitem><para>
  934. <code>setIntermediateChanges($flag)</code> and
  935. <code>getIntermediateChanges()</code>: set and retrieve the
  936. flag indicating whether or not the dijit will send a
  937. notification on each slider change event.
  938. </para></listitem>
  939. <listitem><para>
  940. <code>setShowButtons($flag)</code> and
  941. <code>getShowButtons()</code>: set and retrieve the flag
  942. indicating whether or not buttons on either end will be
  943. displayed; if so, the user can click on these to change the
  944. value of the slider.
  945. </para></listitem>
  946. <listitem><para>
  947. <code>setDiscreteValues($value)</code> and
  948. <code>getDiscreteValues()</code>: set and retrieve the number
  949. of discrete values represented by the slider.
  950. </para></listitem>
  951. <listitem><para>
  952. <code>setMaximum($value)</code> and <code>getMaximum()</code>:
  953. set the maximum value of the slider.
  954. </para></listitem>
  955. <listitem><para>
  956. <code>setMinimum($value)</code> and <code>getMinimum()</code>:
  957. set the minimum value of the slider.
  958. </para></listitem>
  959. <listitem><para>
  960. <code>setPageIncrement($value)</code> and
  961. <code>getPageIncrement()</code>: set the amount by which the
  962. slider will change on keyboard events.
  963. </para></listitem>
  964. </itemizedlist>
  965. <para>
  966. Example usage is provided with each concrete extending class.
  967. </para>
  968. </sect3>
  969. <sect3 id="zend.dojo.form.elements.submitButton">
  970. <title>SubmitButton</title>
  971. <para>
  972. While there is no Dijit named SubmitButton, we include one here to
  973. provide a button dijit capable of submitting a form without
  974. requiring any additional javascript bindings. It works exactly like
  975. the <link linkend="zend.dojo.form.elements.button">Button
  976. dijit</link>.
  977. </para>
  978. <example id="zend.dojo.form.elements.submitButton.example">
  979. <title>Example SubmitButton dijit element usage</title>
  980. <programlisting language="php"><![CDATA[
  981. $form->addElement(
  982. 'SubmitButton',
  983. 'foo',
  984. array(
  985. 'required' => false,
  986. 'ignore' => true,
  987. 'label' => 'Submit Button!',
  988. )
  989. );
  990. ]]></programlisting>
  991. </example>
  992. </sect3>
  993. <sect3 id="zend.dojo.form.elements.textBox">
  994. <title>TextBox</title>
  995. <para>
  996. TextBox is included primarily to provide a text input with
  997. consistent look-and-feel to the other dijits. However, it also
  998. includes some minor filtering and validation capabilities,
  999. represented in the following methods:
  1000. </para>
  1001. <itemizedlist>
  1002. <listitem><para>
  1003. <code>setLowercase($flag)</code> and
  1004. <code>getLowercase()</code>: set and retrieve the flag
  1005. indicating whether or not input should be cast to lowercase.
  1006. </para></listitem>
  1007. <listitem><para>
  1008. <code>setPropercase($flag)</code> and
  1009. <code>getPropercase()</code>: set and retrieve the flag
  1010. indicating whether or not the input should be cast to Proper
  1011. Case.
  1012. </para></listitem>
  1013. <listitem><para>
  1014. <code>setUppercase($flag)</code> and <code>getUppercase()</code>: set and retrieve
  1015. the flag indicating whether or not the input should be cast to UPPERCASE.
  1016. </para></listitem>
  1017. <listitem><para>
  1018. <code>setTrim($flag)</code> and <code>getTrim()</code>: set and
  1019. retrieve the flag indicating whether or not leading or trailing
  1020. whitespace should be stripped.
  1021. </para></listitem>
  1022. <listitem><para>
  1023. <code>setMaxLength($length)</code> and
  1024. <code>getMaxLength()</code>: set and retrieve the maximum
  1025. length of input.
  1026. </para></listitem>
  1027. </itemizedlist>
  1028. <example id="zend.dojo.form.elements.textBox.example">
  1029. <title>Example TextBox dijit element usage</title>
  1030. <programlisting language="php"><![CDATA[
  1031. $form->addElement(
  1032. 'TextBox',
  1033. 'foo',
  1034. array(
  1035. 'value' => 'some text',
  1036. 'label' => 'TextBox',
  1037. 'trim' => true,
  1038. 'propercase' => true,
  1039. )
  1040. );
  1041. ]]></programlisting>
  1042. </example>
  1043. </sect3>
  1044. <sect3 id="zend.dojo.form.elements.textarea">
  1045. <title>Textarea</title>
  1046. <para>
  1047. Textarea acts primarily like a standard HTML textarea. However, it
  1048. does not support either the rows or cols settings. Instead, the
  1049. textarea width should be specified using standard CSS measurements;
  1050. rows should be omitted entirely. The textarea will then grow
  1051. vertically as text is added to it.
  1052. </para>
  1053. <example id="zend.dojo.form.elements.textarea.example">
  1054. <title>Example Textarea dijit element usage</title>
  1055. <programlisting language="php"><![CDATA[
  1056. $form->addElement(
  1057. 'Textarea',
  1058. 'textarea',
  1059. array(
  1060. 'label' => 'Textarea',
  1061. 'required' => true,
  1062. 'style' => 'width: 200px;',
  1063. )
  1064. );
  1065. ]]></programlisting>
  1066. </example>
  1067. </sect3>
  1068. <sect3 id="zend.dojo.form.elements.timeTextBox">
  1069. <title>TimeTextBox</title>
  1070. <para>
  1071. TimeTextBox is a text input that provides a drop-down for selecting
  1072. a time. The drop-down may be configured to show a certain window of
  1073. time, with specified increments.
  1074. </para>
  1075. <para>
  1076. Internally, TimeTextBox derives from <link
  1077. linkend="zend.dojo.form.elements.dateTextBox">DateTextBox</link>,
  1078. <link
  1079. linkend="zend.dojo.form.elements.validationTextBox">ValidationTextBox</link>
  1080. and <link linkend="zend.dojo.form.elements.textBox">TextBox</link>;
  1081. all methods available to those classes are available. In addition,
  1082. the following methods can be used to set individual constraints:
  1083. </para>
  1084. <itemizedlist>
  1085. <listitem><para>
  1086. <code>setTimePattern($pattern)</code> and
  1087. <code>getTimePattern()</code>: set and retrieve the <ulink
  1088. url="http://www.unicode.org/reports/tr35/#Date_Format_Patterns">unicode
  1089. time format pattern</ulink> for formatting the time.
  1090. </para></listitem>
  1091. <listitem><para>
  1092. <code>setClickableIncrement($format)</code> and
  1093. <code>getClickableIncrement()</code>: set the <ulink
  1094. url="http://en.wikipedia.org/wiki/ISO_8601">ISO-8601</ulink>
  1095. string representing the amount by which every clickable element
  1096. in the time picker increases.
  1097. </para></listitem>
  1098. <listitem><para>
  1099. <code>setVisibleIncrement($format)</code> and
  1100. <code>getVisibleIncrement()</code>: set the increment visible
  1101. in the time chooser; must follow ISO-8601 formats.
  1102. </para></listitem>
  1103. <listitem><para>
  1104. <code>setVisibleRange($format)</code> and
  1105. <code>getVisibleRange()</code>: set and retrieve the range of
  1106. time visible in the time chooser at any given moment; must
  1107. follow ISO-8601 formats.
  1108. </para></listitem>
  1109. </itemizedlist>
  1110. <example id="zend.dojo.form.elements.timeTextBox.example">
  1111. <title>Example TimeTextBox dijit element usage</title>
  1112. <para>
  1113. The following will create a TimeTextBox that displays 2 hours
  1114. at a time, with increments of 10 minutes.
  1115. </para>
  1116. <programlisting language="php"><![CDATA[
  1117. $form->addElement(
  1118. 'TimeTextBox',
  1119. 'foo',
  1120. array(
  1121. 'label' => 'TimeTextBox',
  1122. 'required' => true,
  1123. 'visibleRange' => 'T04:00:00',
  1124. 'visibleIncrement' => 'T00:10:00',
  1125. 'clickableIncrement' => 'T00:10:00',
  1126. )
  1127. );
  1128. ]]></programlisting>
  1129. </example>
  1130. </sect3>
  1131. <sect3 id="zend.dojo.form.elements.validationTextBox">
  1132. <title>ValidationTextBox</title>
  1133. <para>
  1134. ValidationTextBox provides the ability to add validations and constraints to a text
  1135. input. Internally, it derives from <link
  1136. linkend="zend.dojo.form.elements.textBox">TextBox</link>, and adds the following
  1137. accessors and mutators for manipulating dijit parameters:
  1138. </para>
  1139. <itemizedlist>
  1140. <listitem><para>
  1141. <code>setInvalidMessage($message)</code> and
  1142. <code>getInvalidMessage()</code>: set and retrieve the tooltip
  1143. message to display when the value does not validate.
  1144. </para></listitem>
  1145. <listitem><para>
  1146. <code>setPromptMessage($message)</code> and
  1147. <code>getPromptMessage()</code>: set and retrieve the tooltip
  1148. message to display for element usage.
  1149. </para></listitem>
  1150. <listitem><para>
  1151. <code>setRegExp($regexp)</code> and <code>getRegExp()</code>:
  1152. set and retrieve the regular expression to use for validating
  1153. the element. The regular expression does not need boundaries
  1154. (unlike PHP's preg* family of functions).
  1155. </para></listitem>
  1156. <listitem><para>
  1157. <code>setConstraint($key, $value)</code> and
  1158. <code>getConstraint($key)</code>: set and retrieve additional
  1159. constraints to use when validating the element; used primarily
  1160. with subclasses. Constraints are stored in the 'constraints'
  1161. key of the dijit parameters.
  1162. </para></listitem>
  1163. <listitem><para>
  1164. <code>setConstraints(array $constraints)</code> and
  1165. <code>getConstraints()</code>: set and retrieve individual
  1166. constraints to use when validating the element; used primarily
  1167. with subclasses.
  1168. </para></listitem>
  1169. <listitem><para>
  1170. <code>hasConstraint($key)</code>: test whether a given
  1171. constraint exists.
  1172. </para></listitem>
  1173. <listitem><para>
  1174. <code>removeConstraint($key)</code> and
  1175. <code>clearConstraints()</code>: remove an individual or all
  1176. constraints for the element.
  1177. </para></listitem>
  1178. </itemizedlist>
  1179. <example id="zend.dojo.form.elements.validationTextBox.example">
  1180. <title>Example ValidationTextBox dijit element usage</title>
  1181. <para>
  1182. The following will create a ValidationTextBox that requires a
  1183. single string consisting solely of word characters (i.e., no
  1184. spaces, most punctuation is invalid).
  1185. </para>
  1186. <programlisting language="php"><![CDATA[
  1187. $form->addElement(
  1188. 'ValidationTextBox',
  1189. 'foo',
  1190. array(
  1191. 'label' => 'ValidationTextBox',
  1192. 'required' => true,
  1193. 'regExp' => '[\w]+',
  1194. 'invalidMessage' => 'Invalid non-space text.',
  1195. )
  1196. );
  1197. ]]></programlisting>
  1198. </example>
  1199. </sect3>
  1200. <sect3 id="zend.dojo.form.elements.verticalSlider">
  1201. <title>VerticalSlider</title>
  1202. <para>
  1203. VerticalSlider is the sibling of <link
  1204. linkend="zend.dojo.form.elements.horizontalSlider">HorizontalSlider</link>,
  1205. and operates in every way like that element. The only real
  1206. difference is that the 'top*' and 'bottom*' methods are replaced by
  1207. 'left*' and 'right*', and instead of using HorizontalRule and
  1208. HorizontalRuleLabels, VerticalRule and VerticalRuleLabels should be
  1209. used.
  1210. </para>
  1211. <example id="zend.dojo.form.elements.verticalSlider.example">
  1212. <title>Example VerticalSlider dijit element usage</title>
  1213. <para>
  1214. The following will create a vertical slider selection with
  1215. integer values ranging from -10 to 10. The left will have labels
  1216. at the 20%, 40%, 60%, and 80% marks. The right will have rules
  1217. at 0, 50%, and 100%. Each time the value is changed, the hidden
  1218. element storing the value will be updated.
  1219. </para>
  1220. <programlisting language="php"><![CDATA[
  1221. $form->addElement(
  1222. 'VerticalSlider',
  1223. 'foo',
  1224. array(
  1225. 'label' => 'VerticalSlider',
  1226. 'value' => 5,
  1227. 'style' => 'height: 200px; width: 3em;',
  1228. 'minimum' => -10,
  1229. 'maximum' => 10,
  1230. 'discreteValues' => 11,
  1231. 'intermediateChanges' => true,
  1232. 'showButtons' => true,
  1233. 'leftDecorationDijit' => 'VerticalRuleLabels',
  1234. 'leftDecorationContainer' => 'leftContainer',
  1235. 'leftDecorationLabels' => array(
  1236. ' ',
  1237. '20%',
  1238. '40%',
  1239. '60%',
  1240. '80%',
  1241. ' ',
  1242. ),
  1243. 'rightDecorationDijit' => 'VerticalRule',
  1244. 'rightDecorationContainer' => 'rightContainer',
  1245. 'rightDecorationLabels' => array(
  1246. '0%',
  1247. '50%',
  1248. '100%',
  1249. ),
  1250. )
  1251. );
  1252. ]]></programlisting>
  1253. </example>
  1254. </sect3>
  1255. </sect2>
  1256. <!--
  1257. vim:se ts=4 sw=4 et:
  1258. -->