Note that there are some explanatory texts on larger screens.

plurals
  1. POcustomValidator without requiredValidator?
    primarykey
    data
    text
    <p>I am struggling with a custom validator for a text field. It seems that the custom validation only works AFTER the required validation is executed. This means that a field without a requiredValidator cannot be custom validated - is that true? What I want to do: </p> <p>I have a text field. The value is only required if a specific value in another field is selected (here this is a checkbox group). It is a dependant validation. My custom validator works fine until the text field is required - but this should not be the case. </p> <p>checkbox does not have the specific value -> text field can be blank<br> checkbox holds the value -> text field must have a value. </p> <p>Any ideas? </p> <pre><code> &lt;xp:inputText id="inputText1" disableClientSideValidation="true"&gt; &lt;/xp:inputText&gt; &lt;xp:inputText id="inputText2" disableClientSideValidation="true"&gt; &lt;xp:this.validators&gt; &lt;xp:customValidator message="err"&gt; &lt;xp:this.validate&gt;&lt;![CDATA[#{javascript:if(getComponentValue("inputText1").length&gt;0 &amp;&amp; getComponentValue("inputText2").length==0) postValidationError(this, "foo")}]]&gt;&lt;/xp:this.validate&gt; &lt;/xp:customValidator&gt; &lt;/xp:this.validators&gt; &lt;/xp:inputText&gt; </code></pre> <p>Where getComponentValue is a method to receive either the value with getValue or getSubmittedValue from the component and postValidationError is a method to add a faces message.</p> <p><strong>EDIT &amp; FINAL ANSWER</strong></p> <p>Conclusion and a sample here: <a href="http://mardou.dyndns.org/Privat/osnippets.nsf/id/OBUE-95BLK4" rel="nofollow">http://mardou.dyndns.org/Privat/osnippets.nsf/id/OBUE-95BLK4</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload