| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- Reviewed: no -->
- <sect2 id="zend.dojo.form.elements">
- <title>Dijit-Specific Form Elements</title>
- <para>
- Each form dijit for which a view helper is provided has a corresponding
- <classname>Zend_Form</classname> element. All of them have the following methods
- available for manipulating dijit parameters:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <methodname>setDijitParam($key, $value)</methodname>: set a single dijit
- parameter. If the dijit parameter already exists, it will be
- overwritten.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setDijitParams(array $params)</methodname>: set several dijit
- parameters at once. Any passed parameters matching those
- already present will overwrite.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>hasDijitParam($key)</methodname>: If a given dijit parameter
- is defined and present, return <constant>TRUE</constant>, otherwise return
- <constant>FALSE</constant>.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>getDijitParam($key)</methodname>: retrieve the given dijit
- parameter. If not available, a <constant>NULL</constant> value is returned.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>getDijitParams()</methodname>: retrieve all dijit parameters.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>removeDijitParam($key)</methodname>: remove the given dijit parameter.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>clearDijitParams()</methodname>: clear all currently defined
- dijit parameters.
- </para>
- </listitem>
- </itemizedlist>
- <para>
- Dijit parameters are stored in the <property>dijitParams</property> public
- property. Thus, you can dijit-enable an existing form element simply by
- setting this property on the element; you simply will not have the
- above accessors to facilitate manipulating the parameters.
- </para>
- <para>
- Additionally, dijit-specific elements implement a different list of
- decorators, corresponding to the following:
- </para>
- <programlisting language="php"><![CDATA[
- $element->addDecorator('DijitElement')
- ->addDecorator('Errors')
- ->addDecorator('HtmlTag', array('tag' => 'dd'))
- ->addDecorator('Label', array('tag' => 'dt'));
- ]]></programlisting>
- <para>
- In effect, the DijitElement decorator is used in place of the standard
- ViewHelper decorator.
- </para>
- <para>
- Finally, the base Dijit element ensures that the Dojo view helper path
- is set on the view.
- </para>
- <para>
- A variant on DijitElement, DijitMulti, provides the functionality of
- the <classname>Multi</classname> abstract form element, allowing the developer to
- specify 'multiOptions' -- typically select options or radio options.
- </para>
- <para>
- The following dijit elements are shipped in the standard Zend
- Framework distribution.
- </para>
- <sect3 id="zend.dojo.form.elements.button">
- <title>Button</title>
- <para>
- While not deriving from <link
- linkend="zend.form.standardElements.button">the standard Button
- element</link>, it does implement the same functionality, and
- can be used as a drop-in replacement for it. The following
- functionality is exposed:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <methodname>getLabel()</methodname> will utilize the element name as the
- button label if no name is provided. Additionally, it will
- translate the name if a translation adapter with a matching
- translation message is available.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>isChecked()</methodname> determines if the value submitted
- matches the label; if so, it returns <constant>TRUE</constant>. This is useful
- for determining which button was used when a form was submitted.
- </para>
- </listitem>
- </itemizedlist>
- <para>
- Additionally, only the decorators <classname>DijitElement</classname> and
- <classname>DtDdWrapper</classname> are utilized for Button elements.
- </para>
- <example id="zend.dojo.form.elements.button.example">
- <title>Example Button dijit element usage</title>
- <programlisting language="php"><![CDATA[
- $form->addElement(
- 'Button',
- 'foo',
- array(
- 'label' => 'Button Label',
- )
- );
- ]]></programlisting>
- </example>
- </sect3>
- <sect3 id="zend.dojo.form.elements.checkBox">
- <title>CheckBox</title>
- <para>
- While not deriving from <link
- linkend="zend.form.standardElements.checkbox">the standard
- Checkbox element</link>, it does implement the same
- functionality. This means that the following methods are exposed:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <methodname>setCheckedValue($value)</methodname>: set the value to use when
- the element is checked.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>getCheckedValue()</methodname>: get the value of the item to
- use when checked.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setUncheckedValue($value)</methodname>: set the value of the
- item to use when it is unchecked.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>getUncheckedValue()</methodname>: get the value of the item to
- use when it is unchecked.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setChecked($flag)</methodname>: mark the element as checked or
- unchecked.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>isChecked()</methodname>: determine if the element is currently
- checked.
- </para>
- </listitem>
- </itemizedlist>
- <example id="zend.dojo.form.elements.checkBox.example">
- <title>Example CheckBox dijit element usage</title>
- <programlisting language="php"><![CDATA[
- $form->addElement(
- 'CheckBox',
- 'foo',
- array(
- 'label' => 'A check box',
- 'checkedValue' => 'foo',
- 'uncheckedValue' => 'bar',
- 'checked' => true,
- )
- );
- ]]></programlisting>
- </example>
- </sect3>
- <sect3 id="zend.dojo.form.elements.comboBox">
- <title>ComboBox and FilteringSelect</title>
- <para>
- As noted in the ComboBox <link
- linkend="zend.dojo.view.dijit.form">dijit view helper
- documentation</link>, ComboBoxes are a hybrid between select
- and text input, allowing for autocompletion and the ability to
- specify an alternate to the options provided. FilteringSelects are
- the same, but do not allow arbitrary input.
- </para>
- <note>
- <title>ComboBoxes return the label values</title>
- <para>
- ComboBoxes return the label values, and not the option values,
- which can lead to a disconnect in expectations. For this reason,
- ComboBoxes do not auto-register an <classname>InArray</classname>
- validator (though FilteringSelects do).
- </para>
- </note>
- <para>
- The ComboBox and FilteringSelect form elements provide accessors and mutators for
- examining and setting the select options as well as specifying a
- <command>dojo.data</command> datastore (if used). They extend from DijitMulti, which
- allows you to specify select options via the
- <methodname>setMultiOptions()</methodname> and <methodname>setMultiOption()</methodname>
- methods. In addition, the following methods are available:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <methodname>getStoreInfo()</methodname>: get all datastore information
- currently set. Returns an empty array if no data is currently set.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setStoreId($identifier)</methodname>: set the store identifier
- variable (usually referred to by the attribute 'jsId' in Dojo).
- This should be a valid javascript variable name.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>getStoreId()</methodname>: retrieve the store identifier
- variable name.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setStoreType($dojoType)</methodname>: set the datastore class
- to use; e.g., "<command>dojo.data.ItemFileReadStore</command>".
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>getStoreType()</methodname>: get the dojo datastore class to use.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setStoreParams(array $params)</methodname>: set any parameters
- used to configure the datastore object. As an example,
- <command>dojo.data.ItemFileReadStore</command> datastore would expect a 'url'
- parameter pointing to a location that would return the
- <command>dojo.data</command> object.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>getStoreParams()</methodname>: get any datastore parameters
- currently set; if none, an empty array is returned.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setAutocomplete($flag)</methodname>: indicate whether or not
- the selected item will be used when the user leaves the element.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>getAutocomplete()</methodname>: get the value of the
- autocomplete flag.
- </para>
- </listitem>
- </itemizedlist>
- <para>
- By default, if no <command>dojo.data</command> store is registered with the element,
- this element registers an <classname>InArray</classname> validator which
- validates against the array keys of registered options. You can
- disable this behavior by either calling
- <methodname>setRegisterInArrayValidator(false)</methodname>, or by passing a
- <constant>FALSE</constant> value to the <property>registerInArrayValidator</property>
- configuration key.
- </para>
- <example id="zend.dojo.form.elements.comboBox.selectExample">
- <title>ComboBox dijit element usage as select input</title>
- <programlisting language="php"><![CDATA[
- $form->addElement(
- 'ComboBox',
- 'foo',
- array(
- 'label' => 'ComboBox (select)',
- 'value' => 'blue',
- 'autocomplete' => false,
- 'multiOptions' => array(
- 'red' => 'Rouge',
- 'blue' => 'Bleu',
- 'white' => 'Blanc',
- 'orange' => 'Orange',
- 'black' => 'Noir',
- 'green' => 'Vert',
- ),
- )
- );
- ]]></programlisting>
- </example>
- <example id="zend.dojo.form.elements.comboBox.datastoreExample">
- <title>ComboBox dijit element usage with datastore</title>
- <programlisting language="php"><![CDATA[
- $form->addElement(
- 'ComboBox',
- 'foo',
- array(
- 'label' => 'ComboBox (datastore)',
- 'storeId' => 'stateStore',
- 'storeType' => 'dojo.data.ItemFileReadStore',
- 'storeParams' => array(
- 'url' => '/js/states.txt',
- ),
- 'dijitParams' => array(
- 'searchAttr' => 'name',
- ),
- )
- );
- ]]></programlisting>
- </example>
- <para>
- The above examples could also utilize <classname>FilteringSelect</classname>
- instead of <classname>ComboBox</classname>.
- </para>
- </sect3>
- <sect3 id="zend.dojo.form.elements.currencyTextBox">
- <title>CurrencyTextBox</title>
- <para>
- The CurrencyTextBox is primarily for supporting currency input. The
- currency may be localized, and can support both fractional and
- non-fractional values.
- </para>
- <para>
- Internally, CurrencyTextBox derives from <link
- linkend="zend.dojo.form.elements.numberTextBox">NumberTextBox</link>,
- <link
- linkend="zend.dojo.form.elements.validationTextBox">ValidationTextBox</link>,
- and <link linkend="zend.dojo.form.elements.textBox">TextBox</link>;
- all methods available to those classes are available. In addition,
- the following constraint methods can be used:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <methodname>setCurrency($currency)</methodname>: set the currency type to
- use; should follow the <ulink
- url="http://en.wikipedia.org/wiki/ISO_4217">ISO-4217</ulink> specification.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>getCurrency()</methodname>: retrieve the current currency type.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setSymbol($symbol)</methodname>: set the 3-letter <ulink
- url="http://en.wikipedia.org/wiki/ISO_4217">ISO-4217</ulink>
- currency symbol to use.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>getSymbol()</methodname>: get the current currency symbol.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setFractional($flag)</methodname>: set whether or not the
- currency should allow for fractional values.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>getFractional()</methodname>: retrieve the status of the
- fractional flag.
- </para>
- </listitem>
- </itemizedlist>
- <example id="zend.dojo.form.elements.currencyTextBox.example">
- <title>Example CurrencyTextBox dijit element usage</title>
- <programlisting language="php"><![CDATA[
- $form->addElement(
- 'CurrencyTextBox',
- 'foo',
- array(
- 'label' => 'Currency:',
- 'required' => true,
- 'currency' => 'USD',
- 'invalidMessage' => 'Invalid amount. ' .
- 'Include dollar sign, commas, and cents.',
- 'fractional' => false,
- )
- );
- ]]></programlisting>
- </example>
- </sect3>
- <sect3 id="zend.dojo.form.elements.dateTextBox">
- <title>DateTextBox</title>
- <para>
- DateTextBox provides a calendar drop-down for selecting a date, as
- well as client-side date validation and formatting.
- </para>
- <para>
- Internally, DateTextBox derives from <link
- linkend="zend.dojo.form.elements.validationTextBox">ValidationTextBox</link>
- and <link linkend="zend.dojo.form.elements.textBox">TextBox</link>;
- all methods available to those classes are available. In addition,
- the following methods can be used to set individual constraints:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <methodname>setAmPm($flag)</methodname> and <methodname>getAmPm()</methodname>:
- Whether or not to use AM or PM strings in times.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setStrict($flag)</methodname> and
- <methodname>getStrict()</methodname>: whether or not to use strict regular
- expression matching when validating input. If <constant>FALSE</constant>, which
- is the default, it will be lenient about whitespace and some abbreviations.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setLocale($locale)</methodname> and
- <methodname>getLocale()</methodname>: Set and retrieve the locale to use with
- this specific element.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setDatePattern($pattern)</methodname> and
- <methodname>getDatePattern()</methodname>: provide and retrieve the <ulink
- url="http://www.unicode.org/reports/tr35/#Date_Format_Patterns">unicode
- date format pattern</ulink> for formatting the date.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setFormatLength($formatLength)</methodname> and
- <methodname>getFormatLength()</methodname>: provide and retrieve the format
- length type to use; should be one of "long", "short", "medium" or "full".
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setSelector($selector)</methodname> and
- <methodname>getSelector()</methodname>: provide and retrieve the style of
- selector; should be either "date" or "time".
- </para>
- </listitem>
- </itemizedlist>
- <example id="zend.dojo.form.elements.dateTextBox.example">
- <title>Example DateTextBox dijit element usage</title>
- <programlisting language="php"><![CDATA[
- $form->addElement(
- 'DateTextBox',
- 'foo',
- array(
- 'label' => 'Date:',
- 'required' => true,
- 'invalidMessage' => 'Invalid date specified.',
- 'formatLength' => 'long',
- )
- );
- ]]></programlisting>
- </example>
- </sect3>
- <sect3 id="zend.dojo.form.elements.editor">
- <title>Editor</title>
- <para>
- Editor provides a <acronym>WYSIWYG</acronym> editor that can be used to both create and
- edit rich <acronym>HTML</acronym> content. <command>dijit.Editor</command> is pluggable
- and may be extended with custom plugins if desired; see <ulink
- url="http://dojotoolkit.org/reference-guide/dijit/Editor.html">the
- dijit.Editor documentation</ulink> for more details.
- </para>
- <para>
- The Editor form element provides a number of accessors and mutators
- for manipulating various dijit parameters, as follows:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <emphasis>captureEvents</emphasis> are events that connect
- to the editing area itself. The following accessors and
- mutators are available for manipulating capture events:
- </para>
- <itemizedlist>
- <listitem>
- <para><methodname>addCaptureEvent($event)</methodname></para>
- </listitem>
- <listitem>
- <para><methodname>addCaptureEvents(array $events)</methodname></para>
- </listitem>
- <listitem>
- <para><methodname>setCaptureEvents(array $events)</methodname></para>
- </listitem>
- <listitem><para><methodname>getCaptureEvents()</methodname></para></listitem>
- <listitem>
- <para><methodname>hasCaptureEvent($event)</methodname></para>
- </listitem>
- <listitem>
- <para><methodname>removeCaptureEvent($event)</methodname></para>
- </listitem>
- <listitem>
- <para><methodname>clearCaptureEvents()</methodname></para>
- </listitem>
- </itemizedlist>
- </listitem>
- <listitem>
- <para>
- <emphasis>events</emphasis> are standard <acronym>DOM</acronym> events, such as
- onClick, onKeyUp, etc. The following accessors and mutators
- are available for manipulating events:
- </para>
- <itemizedlist>
- <listitem><para><methodname>addEvent($event)</methodname></para></listitem>
- <listitem>
- <para><methodname>addEvents(array $events)</methodname></para>
- </listitem>
- <listitem>
- <para><methodname>setEvents(array $events)</methodname></para>
- </listitem>
- <listitem><para><methodname>getEvents()</methodname></para></listitem>
- <listitem><para><methodname>hasEvent($event)</methodname></para></listitem>
- <listitem><para><methodname>removeEvent($event)</methodname></para></listitem>
- <listitem><para><methodname>clearEvents()</methodname></para></listitem>
- </itemizedlist>
- </listitem>
- <listitem>
- <para>
- <emphasis>plugins</emphasis> add functionality to the
- Editor -- additional tools for the toolbar, additional
- styles to allow, etc. The following accessors and mutators
- are available for manipulating plugins:
- </para>
- <itemizedlist>
- <listitem><para><methodname>addPlugin($plugin)</methodname></para></listitem>
- <listitem>
- <para><methodname>addPlugins(array $plugins)</methodname></para>
- </listitem>
- <listitem>
- <para><methodname>setPlugins(array $plugins)</methodname></para>
- </listitem>
- <listitem><para><methodname>getPlugins()</methodname></para></listitem>
- <listitem><para><methodname>hasPlugin($plugin)</methodname></para></listitem>
- <listitem><para><methodname>removePlugin($plugin)</methodname></para></listitem>
- <listitem><para><methodname>clearPlugins()</methodname></para></listitem>
- </itemizedlist>
- </listitem>
- <listitem>
- <para>
- <emphasis>editActionInterval</emphasis> is used to group
- events for undo operations. By default, this value is 3
- seconds. The method
- <methodname>setEditActionInterval($interval)</methodname> may be used to
- set the value, while <methodname>getEditActionInterval()</methodname>
- will retrieve it.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>focusOnLoad</emphasis> is used to determine
- whether this particular editor will receive focus when the
- page has loaded. By default, this is <constant>FALSE</constant>. The method
- <methodname>setFocusOnLoad($flag)</methodname> may be used to
- set the value, while <methodname>getFocusOnLoad()</methodname>
- will retrieve it.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>height</emphasis> specifies the height of the
- editor; by default, this is 300px. The method
- <methodname>setHeight($height)</methodname> may be used to set the
- value, while <methodname>getHeight()</methodname> will retrieve it.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>inheritWidth</emphasis> is used to determine
- whether the editor will use the parent container's width or
- simply default to 100% width. By default, this is <constant>FALSE</constant>
- (i.e., it will fill the width of the window). The method
- <methodname>setInheritWidth($flag)</methodname> may be used to set the
- value, while <methodname>getInheritWidth()</methodname> will retrieve
- it.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>minHeight</emphasis> indicates the minimum height
- of the editor; by default, this is 1em. The method
- <methodname>setMinHeight($height)</methodname> may be used to set the
- value, while <methodname>getMinHeight()</methodname> will retrieve it.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>styleSheets</emphasis> indicate what additional
- <acronym>CSS</acronym> stylesheets should be used to affect the display of the
- Editor. By default, none are registered, and it inherits the
- page styles. The following accessors and mutators are
- available for manipulating editor stylesheets:
- </para>
- <itemizedlist>
- <listitem>
- <para><methodname>addStyleSheet($styleSheet)</methodname></para>
- </listitem>
- <listitem>
- <para><methodname>addStyleSheets(array $styleSheets)</methodname></para>
- </listitem>
- <listitem>
- <para><methodname>setStyleSheets(array $styleSheets)</methodname></para>
- </listitem>
- <listitem><para><methodname>getStyleSheets()</methodname></para></listitem>
- <listitem>
- <para><methodname>hasStyleSheet($styleSheet)</methodname></para>
- </listitem>
- <listitem>
- <para><methodname>removeStyleSheet($styleSheet)</methodname></para>
- </listitem>
- <listitem><para><methodname>clearStyleSheets()</methodname></para></listitem>
- </itemizedlist>
- </listitem>
- </itemizedlist>
- <example id="zend.dojo.form.elements.editor.example">
- <title>Example Editor dijit element usage</title>
- <programlisting language="php"><![CDATA[
- $form->addElement('editor', 'content', array(
- 'plugins' => array('undo', '|', 'bold', 'italic'),
- 'editActionInterval' => 2,
- 'focusOnLoad' => true,
- 'height' => '250px',
- 'inheritWidth' => true,
- 'styleSheets' => array('/js/custom/editor.css'),
- ));
- ]]></programlisting>
- </example>
- <note>
- <title>Editor Dijit uses div by default</title>
- <para>
- The Editor dijit uses an <acronym>HTML</acronym> <acronym>DIV</acronym> by default.
- The <command>dijit._editor.RichText</command> documentation indicates that
- having it built on an <acronym>HTML</acronym> <acronym>TEXTAREA</acronym> can
- potentially have security implications.
- </para>
- <para>
- That said, there may be times when you want an Editor widget that can gracefully
- degrade to a <acronym>TEXTAREA</acronym>. In such situations, you can do so by
- setting the <property>degrade</property> property to <constant>TRUE</constant>:
- </para>
- <programlisting language="php"><![CDATA[
- // At instantiation:
- $editor = new Zend_Dojo_Form_Element_Editor('foo', array(
- 'degrade' => true,
- ));
- // Construction via the form:
- $form->addElement('editor', 'content', array(
- 'degrade' => true,
- ));
- // Or after instantiation:
- $editor->degrade = true;
- ]]></programlisting>
- </note>
- </sect3>
- <sect3 id="zend.dojo.form.elements.horizontalSlider">
- <title>HorizontalSlider</title>
- <para>
- HorizontalSlider provides a slider UI widget for selecting a
- numeric value in a range. Internally, it sets the value of a hidden
- element which is submitted by the form.
- </para>
- <para>
- HorizontalSlider derives from the <link
- linkend="zend.dojo.form.elements.slider">abstract Slider dijit
- element</link>. Additionally, it has a variety of methods for
- setting and configuring slider rules and rule labels.
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <methodname>setTopDecorationDijit($dijit)</methodname> and
- <methodname>setBottomDecorationDijit($dijit)</methodname>: set the name
- of the dijit to use for either the top or bottom of the
- slider. This should not include the "dijit.form." prefix,
- but rather only the final name -- one of "HorizontalRule"
- or "HorizontalRuleLabels".
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setTopDecorationContainer($container)</methodname> and
- <methodname>setBottomDecorationContainer($container)</methodname>:
- specify the name to use for the container element of the
- rules; e.g. 'topRule', 'topContainer', etc.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setTopDecorationLabels(array $labels)</methodname> and
- <methodname>setBottomDecorationLabels(array $labels)</methodname>: set
- the labels to use for one of the RuleLabels dijit types.
- These should be an indexed array; specify a single empty
- space to skip a given label position (such as the beginning
- or end).
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setTopDecorationParams(array $params)</methodname> and
- <methodname>setBottomDecorationParams(array $params)</methodname>:
- dijit parameters to use when configuring the given Rule or
- RuleLabels dijit.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setTopDecorationAttribs(array $attribs)</methodname> and
- <methodname>setBottomDecorationAttribs(array $attribs)</methodname>:
- <acronym>HTML</acronym> attributes to specify for the given Rule or RuleLabels
- <acronym>HTML</acronym> element container.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>getTopDecoration()</methodname> and
- <methodname>getBottomDecoration()</methodname>: retrieve all metadata
- for a given Rule or RuleLabels definition, as provided by
- the above mutators.
- </para>
- </listitem>
- </itemizedlist>
- <example id="zend.dojo.form.elements.horizontalSlider.example">
- <title>Example HorizontalSlider dijit element usage</title>
- <para>
- The following will create a horizontal slider selection with
- integer values ranging from -10 to 10. The top will have labels
- at the 20%, 40%, 60%, and 80% marks. The bottom will have rules
- at 0, 50%, and 100%. Each time the value is changed, the hidden
- element storing the value will be updated.
- </para>
- <programlisting language="php"><![CDATA[
- $form->addElement(
- 'HorizontalSlider',
- 'horizontal',
- array(
- 'label' => 'HorizontalSlider',
- 'value' => 5,
- 'minimum' => -10,
- 'maximum' => 10,
- 'discreteValues' => 11,
- 'intermediateChanges' => true,
- 'showButtons' => true,
- 'topDecorationDijit' => 'HorizontalRuleLabels',
- 'topDecorationContainer' => 'topContainer',
- 'topDecorationLabels' => array(
- ' ',
- '20%',
- '40%',
- '60%',
- '80%',
- ' ',
- ),
- 'topDecorationParams' => array(
- 'container' => array(
- 'style' => 'height:1.2em; font-size=75%;color:gray;',
- ),
- 'list' => array(
- 'style' => 'height:1em; font-size=75%;color:gray;',
- ),
- ),
- 'bottomDecorationDijit' => 'HorizontalRule',
- 'bottomDecorationContainer' => 'bottomContainer',
- 'bottomDecorationLabels' => array(
- '0%',
- '50%',
- '100%',
- ),
- 'bottomDecorationParams' => array(
- 'list' => array(
- 'style' => 'height:1em; font-size=75%;color:gray;',
- ),
- ),
- )
- );
- ]]></programlisting>
- </example>
- </sect3>
- <sect3 id="zend.dojo.form.elements.numberSpinner">
- <title>NumberSpinner</title>
- <para>
- A number spinner is a text element for entering numeric values; it
- also includes elements for incrementing and decrementing the value
- by a set amount.
- </para>
- <para>
- The following methods are available:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <methodname>setDefaultTimeout($timeout)</methodname> and
- <methodname>getDefaultTimeout()</methodname>: set and retrieve the default
- timeout, in milliseconds, between when the button is held
- pressed and the value is changed.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setTimeoutChangeRate($rate)</methodname> and
- <methodname>getTimeoutChangeRate()</methodname>: set and retrieve the
- rate, in milliseconds, at which changes will be made when a
- button is held pressed.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setLargeDelta($delta)</methodname> and
- <methodname>getLargeDelta()</methodname>: set and retrieve the amount by
- which the numeric value should change when a button is held pressed.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setSmallDelta($delta)</methodname> and
- <methodname>getSmallDelta()</methodname>: set and retrieve the delta by
- which the number should change when a button is pressed once.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setIntermediateChanges($flag)</methodname> and
- <methodname>getIntermediateChanges()</methodname>: set and retrieve the
- flag indicating whether or not each value change should be
- shown when a button is held pressed.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setRangeMessage($message)</methodname> and
- <methodname>getRangeMessage()</methodname>: set and retrieve the message
- indicating the range of values available.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setMin($value)</methodname> and <methodname>getMin()</methodname>:
- set and retrieve the minimum value possible.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setMax($value)</methodname> and <methodname>getMax()</methodname>:
- set and retrieve the maximum value possible.
- </para>
- </listitem>
- </itemizedlist>
- <example id="zend.dojo.form.elements.numberSpinner.example">
- <title>Example NumberSpinner dijit element usage</title>
- <programlisting language="php"><![CDATA[
- $form->addElement(
- 'NumberSpinner',
- 'foo',
- array(
- 'value' => '7',
- 'label' => 'NumberSpinner',
- 'smallDelta' => 5,
- 'largeDelta' => 25,
- 'defaultTimeout' => 500,
- 'timeoutChangeRate' => 100,
- 'min' => 9,
- 'max' => 1550,
- 'places' => 0,
- 'maxlength' => 20,
- )
- );
- ]]></programlisting>
- </example>
- </sect3>
- <sect3 id="zend.dojo.form.elements.numberTextBox">
- <title>NumberTextBox</title>
- <para>
- A number text box is a text element for entering numeric values;
- unlike NumberSpinner, numbers are entered manually. Validations and
- constraints can be provided to ensure the number stays in a
- particular range or format.
- </para>
- <para>
- Internally, NumberTextBox derives from <link
- linkend="zend.dojo.form.elements.validationTextBox">ValidationTextBox</link>
- and <link linkend="zend.dojo.form.elements.textBox">TextBox</link>;
- all methods available to those classes are available. In addition,
- the following methods can be used to set individual constraints:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <methodname>setLocale($locale)</methodname> and
- <methodname>getLocale()</methodname>: specify and retrieve a specific or
- alternate locale to use with this dijit.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setPattern($pattern)</methodname> and
- <methodname>getPattern()</methodname>: set and retrieve a <ulink
- url="http://www.unicode.org/reports/tr35/#Number_Format_Patterns">number
- pattern format</ulink> to use to format the number.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setType($type)</methodname> and <methodname>getType()</methodname>:
- set and retrieve the numeric format type to use (should be one of
- 'decimal', 'percent', or 'currency').
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setPlaces($places)</methodname> and
- <methodname>getPlaces()</methodname>: set and retrieve the number of decimal
- places to support.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setStrict($flag)</methodname> and
- <methodname>getStrict()</methodname>: set and retrieve the value of the strict
- flag, which indicates how much leniency is allowed in relation to whitespace and
- non-numeric characters.
- </para>
- </listitem>
- </itemizedlist>
- <example id="zend.dojo.form.elements.numberTextBox.example">
- <title>Example NumberTextBox dijit element usage</title>
- <programlisting language="php"><![CDATA[
- $form->addElement(
- 'NumberTextBox',
- 'elevation',
- array(
- 'label' => 'NumberTextBox',
- 'required' => true,
- 'invalidMessage' => 'Invalid elevation.',
- 'places' => 0,
- 'constraints' => array(
- 'min' => -20000,
- 'max' => 20000,
- ),
- )
- );
- ]]></programlisting>
- </example>
- </sect3>
- <sect3 id="zend.dojo.form.elements.passwordTextBox">
- <title>PasswordTextBox</title>
- <para>
- PasswordTextBox is simply a ValidationTextBox that is tied to a
- password input; its sole purpose is to allow for a dijit-themed text
- entry for passwords that also provides client-side validation.
- </para>
- <para>
- Internally, PasswordTextBox derives from <link
- linkend="zend.dojo.form.elements.validationTextBox">ValidationTextBox</link>
- and <link linkend="zend.dojo.form.elements.textBox">TextBox</link>;
- all methods available to those classes are available.
- </para>
- <example id="zend.dojo.form.elements.passwordTextBox.example">
- <title>Example PasswordTextBox dijit element usage</title>
- <programlisting language="php"><![CDATA[
- $form->addElement(
- 'PasswordTextBox',
- 'password',
- array(
- 'label' => 'Password',
- 'required' => true,
- 'trim' => true,
- 'lowercase' => true,
- 'regExp' => '^[a-z0-9]{6,}$',
- 'invalidMessage' => 'Invalid password; ' .
- 'must be at least 6 alphanumeric characters',
- )
- );
- ]]></programlisting>
- </example>
- </sect3>
- <sect3 id="zend.dojo.form.elements.radioButton">
- <title>RadioButton</title>
- <para>
- RadioButton wraps standard radio input elements to provide a
- consistent look and feel with other dojo dijits.
- </para>
- <para>
- RadioButton extends from DijitMulti, which
- allows you to specify select options via the
- <methodname>setMultiOptions()</methodname> and <methodname>setMultiOption()</methodname>
- methods.
- </para>
- <para>
- By default, this element registers an <classname>InArray</classname> validator
- which validates against the array keys of registered options. You
- can disable this behavior by either calling
- <methodname>setRegisterInArrayValidator(false)</methodname>, or by passing a
- <constant>FALSE</constant> value to the <property>registerInArrayValidator</property>
- configuration key.
- </para>
- <example id="zend.dojo.form.elements.radioButton.example">
- <title>Example RadioButton dijit element usage</title>
- <programlisting language="php"><![CDATA[
- $form->addElement(
- 'RadioButton',
- 'foo',
- array(
- 'label' => 'RadioButton',
- 'multiOptions' => array(
- 'foo' => 'Foo',
- 'bar' => 'Bar',
- 'baz' => 'Baz',
- ),
- 'value' => 'bar',
- )
- );
- ]]></programlisting>
- </example>
- </sect3>
- <sect3 id="zend.dojo.form.elements.simpletextarea">
- <title>SimpleTextarea</title>
- <para>
- SimpleTextarea acts primarily like a standard <acronym>HTML</acronym> textarea. However,
- it does not support either the rows or cols settings. Instead, the
- textarea width should be specified using standard <acronym>CSS</acronym> measurements.
- Unlike Textarea, it will not grow automatically
- </para>
- <example id="zend.dojo.form.elements.simpletextarea.example">
- <title>Example SimpleTextarea dijit element usage</title>
- <programlisting language="php"><![CDATA[
- $form->addElement(
- 'SimpleTextarea',
- 'simpletextarea',
- array(
- 'label' => 'SimpleTextarea',
- 'required' => true,
- 'style' => 'width: 80em; height: 25em;',
- )
- );
- ]]></programlisting>
- </example>
- </sect3>
- <sect3 id="zend.dojo.form.elements.slider">
- <title>Slider abstract element</title>
- <para>
- Slider is an abstract element from which
- <link linkend="zend.dojo.form.elements.horizontalSlider">HorizontalSlider</link>
- and <link linkend="zend.dojo.form.elements.verticalSlider">VerticalSlider</link>
- both derive. It exposes a number of common methods for configuring
- your sliders, including:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <methodname>setClickSelect($flag)</methodname> and
- <methodname>getClickSelect()</methodname>: set and retrieve the flag
- indicating whether or not clicking the slider changes the value.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setIntermediateChanges($flag)</methodname> and
- <methodname>getIntermediateChanges()</methodname>: set and retrieve the
- flag indicating whether or not the dijit will send a
- notification on each slider change event.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setShowButtons($flag)</methodname> and
- <methodname>getShowButtons()</methodname>: set and retrieve the flag
- indicating whether or not buttons on either end will be
- displayed; if so, the user can click on these to change the
- value of the slider.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setDiscreteValues($value)</methodname> and
- <methodname>getDiscreteValues()</methodname>: set and retrieve the number
- of discrete values represented by the slider.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setMaximum($value)</methodname> and
- <methodname>getMaximum()</methodname>: set the maximum value of the slider.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setMinimum($value)</methodname> and
- <methodname>getMinimum()</methodname>: set the minimum value of the slider.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setPageIncrement($value)</methodname> and
- <methodname>getPageIncrement()</methodname>: set the amount by which the
- slider will change on keyboard events.
- </para>
- </listitem>
- </itemizedlist>
- <para>
- Example usage is provided with each concrete extending class.
- </para>
- </sect3>
- <sect3 id="zend.dojo.form.elements.submitButton">
- <title>SubmitButton</title>
- <para>
- While there is no Dijit named SubmitButton, we include one here to
- provide a button dijit capable of submitting a form without
- requiring any additional javascript bindings. It works exactly like
- the <link linkend="zend.dojo.form.elements.button">Button dijit</link>.
- </para>
- <example id="zend.dojo.form.elements.submitButton.example">
- <title>Example SubmitButton dijit element usage</title>
- <programlisting language="php"><![CDATA[
- $form->addElement(
- 'SubmitButton',
- 'foo',
- array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Submit Button!',
- )
- );
- ]]></programlisting>
- </example>
- </sect3>
- <sect3 id="zend.dojo.form.elements.textBox">
- <title>TextBox</title>
- <para>
- TextBox is included primarily to provide a text input with
- consistent look-and-feel to the other dijits. However, it also
- includes some minor filtering and validation capabilities,
- represented in the following methods:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <methodname>setLowercase($flag)</methodname> and
- <methodname>getLowercase()</methodname>: set and retrieve the flag
- indicating whether or not input should be cast to lowercase.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setPropercase($flag)</methodname> and
- <methodname>getPropercase()</methodname>: set and retrieve the flag
- indicating whether or not the input should be cast to Proper Case.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setUppercase($flag)</methodname> and
- <methodname>getUppercase()</methodname>: set and retrieve
- the flag indicating whether or not the input should be cast to
- <acronym>UPPERCASE</acronym>.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setTrim($flag)</methodname> and <methodname>getTrim()</methodname>:
- set and retrieve the flag indicating whether or not leading or trailing
- whitespace should be stripped.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setMaxLength($length)</methodname> and
- <methodname>getMaxLength()</methodname>: set and retrieve the maximum
- length of input.
- </para>
- </listitem>
- </itemizedlist>
- <example id="zend.dojo.form.elements.textBox.example">
- <title>Example TextBox dijit element usage</title>
- <programlisting language="php"><![CDATA[
- $form->addElement(
- 'TextBox',
- 'foo',
- array(
- 'value' => 'some text',
- 'label' => 'TextBox',
- 'trim' => true,
- 'propercase' => true,
- )
- );
- ]]></programlisting>
- </example>
- </sect3>
- <sect3 id="zend.dojo.form.elements.textarea">
- <title>Textarea</title>
- <para>
- Textarea acts primarily like a standard <acronym>HTML</acronym> textarea. However, it
- does not support either the rows or cols settings. Instead, the
- textarea width should be specified using standard <acronym>CSS</acronym> measurements;
- rows should be omitted entirely. The textarea will then grow
- vertically as text is added to it.
- </para>
- <example id="zend.dojo.form.elements.textarea.example">
- <title>Example Textarea dijit element usage</title>
- <programlisting language="php"><![CDATA[
- $form->addElement(
- 'Textarea',
- 'textarea',
- array(
- 'label' => 'Textarea',
- 'required' => true,
- 'style' => 'width: 200px;',
- )
- );
- ]]></programlisting>
- </example>
- </sect3>
- <sect3 id="zend.dojo.form.elements.timeTextBox">
- <title>TimeTextBox</title>
- <para>
- TimeTextBox is a text input that provides a drop-down for selecting
- a time. The drop-down may be configured to show a certain window of
- time, with specified increments.
- </para>
- <para>
- Internally, TimeTextBox derives from <link
- linkend="zend.dojo.form.elements.dateTextBox">DateTextBox</link>,
- <link
- linkend="zend.dojo.form.elements.validationTextBox">ValidationTextBox</link>
- and <link linkend="zend.dojo.form.elements.textBox">TextBox</link>;
- all methods available to those classes are available. In addition,
- the following methods can be used to set individual constraints:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <methodname>setTimePattern($pattern)</methodname> and
- <methodname>getTimePattern()</methodname>: set and retrieve the <ulink
- url="http://www.unicode.org/reports/tr35/#Date_Format_Patterns">unicode
- time format pattern</ulink> for formatting the time.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setClickableIncrement($format)</methodname> and
- <methodname>getClickableIncrement()</methodname>: set the <ulink
- url="http://en.wikipedia.org/wiki/ISO_8601">ISO_8601</ulink>
- string representing the amount by which every clickable element
- in the time picker increases.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setVisibleIncrement($format)</methodname> and
- <methodname>getVisibleIncrement()</methodname>: set the increment visible
- in the time chooser; must follow <constant>ISO_8601</constant> formats.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setVisibleRange($format)</methodname> and
- <methodname>getVisibleRange()</methodname>: set and retrieve the range of
- time visible in the time chooser at any given moment; must
- follow <constant>ISO_8601</constant> formats.
- </para>
- </listitem>
- </itemizedlist>
- <example id="zend.dojo.form.elements.timeTextBox.example">
- <title>Example TimeTextBox dijit element usage</title>
- <para>
- The following will create a TimeTextBox that displays 2 hours
- at a time, with increments of 10 minutes.
- </para>
- <programlisting language="php"><![CDATA[
- $form->addElement(
- 'TimeTextBox',
- 'foo',
- array(
- 'label' => 'TimeTextBox',
- 'required' => true,
- 'visibleRange' => 'T04:00:00',
- 'visibleIncrement' => 'T00:10:00',
- 'clickableIncrement' => 'T00:10:00',
- )
- );
- ]]></programlisting>
- </example>
- </sect3>
- <sect3 id="zend.dojo.form.elements.validationTextBox">
- <title>ValidationTextBox</title>
- <para>
- ValidationTextBox provides the ability to add validations and constraints to a text
- input. Internally, it derives from <link
- linkend="zend.dojo.form.elements.textBox">TextBox</link>, and adds the following
- accessors and mutators for manipulating dijit parameters:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <methodname>setInvalidMessage($message)</methodname> and
- <methodname>getInvalidMessage()</methodname>: set and retrieve the tooltip
- message to display when the value does not validate.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setPromptMessage($message)</methodname> and
- <methodname>getPromptMessage()</methodname>: set and retrieve the tooltip
- message to display for element usage.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setRegExp($regexp)</methodname> and
- <methodname>getRegExp()</methodname>: set and retrieve the regular expression to
- use for validating the element. The regular expression does not need boundaries
- (unlike <acronym>PHP</acronym>'s preg* family of functions).
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setConstraint($key, $value)</methodname> and
- <methodname>getConstraint($key)</methodname>: set and retrieve additional
- constraints to use when validating the element; used primarily
- with subclasses. Constraints are stored in the 'constraints'
- key of the dijit parameters.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>setConstraints(array $constraints)</methodname> and
- <methodname>getConstraints()</methodname>: set and retrieve individual
- constraints to use when validating the element; used primarily with subclasses.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>hasConstraint($key)</methodname>: test whether a given constraint
- exists.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>removeConstraint($key)</methodname> and
- <methodname>clearConstraints()</methodname>: remove an individual or all
- constraints for the element.
- </para>
- </listitem>
- </itemizedlist>
- <example id="zend.dojo.form.elements.validationTextBox.example">
- <title>Example ValidationTextBox dijit element usage</title>
- <para>
- The following will create a ValidationTextBox that requires a
- single string consisting solely of word characters (i.e., no
- spaces, most punctuation is invalid).
- </para>
- <programlisting language="php"><![CDATA[
- $form->addElement(
- 'ValidationTextBox',
- 'foo',
- array(
- 'label' => 'ValidationTextBox',
- 'required' => true,
- 'regExp' => '[\w]+',
- 'invalidMessage' => 'Invalid non-space text.',
- )
- );
- ]]></programlisting>
- </example>
- </sect3>
- <sect3 id="zend.dojo.form.elements.verticalSlider">
- <title>VerticalSlider</title>
- <para>
- VerticalSlider is the sibling of <link
- linkend="zend.dojo.form.elements.horizontalSlider">HorizontalSlider</link>,
- and operates in every way like that element. The only real
- difference is that the 'top*' and 'bottom*' methods are replaced by
- 'left*' and 'right*', and instead of using HorizontalRule and
- HorizontalRuleLabels, VerticalRule and VerticalRuleLabels should be
- used.
- </para>
- <example id="zend.dojo.form.elements.verticalSlider.example">
- <title>Example VerticalSlider dijit element usage</title>
- <para>
- The following will create a vertical slider selection with
- integer values ranging from -10 to 10. The left will have labels
- at the 20%, 40%, 60%, and 80% marks. The right will have rules
- at 0, 50%, and 100%. Each time the value is changed, the hidden
- element storing the value will be updated.
- </para>
- <programlisting language="php"><![CDATA[
- $form->addElement(
- 'VerticalSlider',
- 'foo',
- array(
- 'label' => 'VerticalSlider',
- 'value' => 5,
- 'style' => 'height: 200px; width: 3em;',
- 'minimum' => -10,
- 'maximum' => 10,
- 'discreteValues' => 11,
- 'intermediateChanges' => true,
- 'showButtons' => true,
- 'leftDecorationDijit' => 'VerticalRuleLabels',
- 'leftDecorationContainer' => 'leftContainer',
- 'leftDecorationLabels' => array(
- ' ',
- '20%',
- '40%',
- '60%',
- '80%',
- ' ',
- ),
- 'rightDecorationDijit' => 'VerticalRule',
- 'rightDecorationContainer' => 'rightContainer',
- 'rightDecorationLabels' => array(
- '0%',
- '50%',
- '100%',
- ),
- )
- );
- ]]></programlisting>
- </example>
- </sect3>
- </sect2>
- <!--
- vim:se ts=4 sw=4 et:
- -->
|