Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Boolean "OR" connect of validators in ds.xml possible?

    Hi Isomorphic,

    is it possible to create a Validator consisting out of two seperate Validators in ds.xml an connect them via OR?

    I'm thinking of something like this:
    Code:
    <field name="x" type="int">
    	<validators>
    		<validatorgroup connect="or" errorMessage="Not either 1..10, 101..110">
    			<validator type="integerRange" min="1" max="10"></validator>
    			<validator type="integerRange" min="101" max="110"></validator>
    		</validatorgroup>
    	</validators>
    </field>
    IMO the "OR" is missing there, AND is existing by just naming two validators.
    From what I know I could do it with velocity like
    Code:
    <validators>
    	<validator type="serverCustom"
    		serverCondition="($value &gt;= 1 &amp;&amp; $value &lt;= 10) 		|| ($value &gt;= 101 &amp;&amp; $value &lt;= 110)"
    		errorMessage="Not either 1..10, 101..110"/>
    </validators>
    but then it will only validate on the server.

    Is this correct or am I missing something here?

    Best regards,
    Blama

    #2
    You currently can't declaratively OR validators. If you build a custom validator via Velocity on the server, you can also use the client-side custom Validator interface to add client-side enforcement.

    Comment

    Working...
    X