Zend_Dojo-Form-Elements.xml 62 KB

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