BlueFonzie


Hello,

Can you please point me to an example of <constraints> in a Block XML

Thanks a lot.




Re: <constraints> example

AndyS


Sure, the most common use of contstraints is to force the user to select one option from a group of options, in the UI this appears as a combo box, for example the Live Search block uses it to limit choices of the "adult" field to Moderate, Strict or Off.
Code Snippet

<input name="adult" required="false" type="string">
<description>Adult Setting</description>
<defaultValue>Off</defaultValue>
<constraints>
<constraint mandatory="true" type="oneOf">
<value>Moderate</value>
<value>Strict</value>
<value>Off</value>
</constraint>
</constraints>
</input>


The other use of constraints is to enforce min and max values for numbers as the example from live news below shows:

Code Snippet

<input name="first" required="false" type="nonNegativeInteger">
<description>The index of the first result (&lt;250)</description>
<defaultValue>0</defaultValue>
<constraints>
<constraint mandatory="true" type="maxValue">
<value>250</value>
</constraint>
<constraint mandatory="true" type="minValue">
<value>0</value>
</constraint>
</constraints>
</input>







Re: <constraints> example

toddg3s

Is there a way to build the list of values dynamically, or to pull it from an external XML file Something like src=""

Thanks,

Todd