You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Joost Kuif <Jo...@mobillion.nl> on 2006/01/20 16:59:11 UTC

Cforms multiple validations

Hi,

It seems that it's not possible to cross-check if two fields have the
same value. Example below gives only a warning on the second field....

<fd:field id="password" required="true">
<fd:label>
  <i18n:text i18n:key="register.password">Wachtwoord</i18n:text>
</fd:label>
<fd:datatype base="string"/>
  <fd:validation>
    <fd:assert test="password = passwordretyped">
      <fd:failmessage><i18n:text
i18n:key="register.passwordretyped.notok2"> Wachtwoorden zijn  niet
identiek</i18n:text>
      </fd:failmessage>
    </fd:assert> 
  </fd:validation>
</fd:field>
    
<fd:field id="passwordretyped" required="true">
  <fd:label>
    <i18n:text i18n:key="register.passwordretyped2">Wachtwoord
nogmaals</i18n:text>
  </fd:label>
  <fd:datatype base="string"/>
  <fd:validation>
    <fd:assert test="password = passwordretyped">
      <fd:failmessage><i18n:text
i18n:key="register.passwordretyped.notok">Wachtwoorden zijn niet
identiek</i18n:text></fd:failmessage>
    </fd:assert>
  </fd:validation>
</fd:field>



Second situation, one field with two validations. It looks like only the
first validation is evaluated.

<fd:field id="password" required="true">
<fd:label>
  <i18n:text i18n:key="register.password">Wachtwoord</i18n:text>
</fd:label>
<fd:datatype base="string"/>
  <fd:validation>
    <fd:length min="6" max="15">
      <fd:failmessage>
         <i18n:text i18n:key="register.password.fail">U heeft geen
valide wachtwoord ingevoerd, een wachtwoord moet bestaan uit minimaal 4
letters en 2 cijfers</i18n:text>
      </fd:failmessage>
    </fd:length>
    <fd:assert test="password = passwordretyped">
      <fd:failmessage><i18n:text i18n:key="register.passwordretyped">
Wachtwoorden zijn  niet identiek</i18n:text>
      </fd:failmessage>
    </fd:assert> 
  </fd:validation>
</fd:field>


Is the only solution custom made javascript-validation?

Joost


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org