|
Hi, Last Friday i mailed this list about cross checking in
multiple fields. I have changed this code with some _javascript_ validation, and
still I encounter unexpected behaviour.. I have included the output of these system.out statements
here: Input in form: Password 123456 Passwordretyped 123456 Console: passwordretyped: pass1 = 123456 pass2 = 123456 password: pass1 = 123456 pass2 = 123456 passwordretyped:
pass1 = 123456 pass2 = 123456 Input in form: Password 123 Passwordretyped 12345 Console: passwordretyped: pass1 = 123 pass2 = 12345 password: pass1 = 123 pass2 = null passwordretyped:
pass1 = null pass2 = 12345 These null values are not what you would expect… And
why is the passwordretyped field validated twice? Does anyone have a idea/suggestion? Joost The form definition: <fd:field id="password" required="true"> <fd:label><i18n:text i18n:key="register.password">Wachtwoord</i18n:text></fd:label> <fd:help><i18n:text i18n:key="register.password.help">Kies een wachtwoord
bestaande uit minimaal 4 letters en 2 cijfers</i18n:text></fd:help> <fd:datatype base="string"/> <fd:validation> <fd:_javascript_> var
pass1 = widget.getValue(); var
pass2 =
widget.getParent().lookupWidget("passwordretyped").getValue();
java.lang.System.out.println("password: pass1 = " + pass1 + "
pass2 = " + pass2); if
(pass1.equals(pass2) == false ) { var
i18nMessage = new
Packages.org.apache.cocoon.forms.util.I18nMessage("someErrorMsg",
"tt"); widget.setValidationError(new
Packages.org.apache.cocoon.forms.validation.ValidationError(i18nMessage)); return
false; } return
true; </fd:_javascript_> </fd:validation> </fd:field> <fd:field id="passwordretyped" required="true"> <fd:label><i18n:text i18n:key="register.passwordretyped">Wachtwoord nogmaals</i18n:text></fd:label> <fd:help><i18n:text i18n:key="register.passwordretyped.help">Ter controle voer je
hier nogmaals je gekozen wachtwoord in</i18n:text></fd:help> <fd:datatype base="string"/> <fd:validation> <fd:_javascript_> var
pass1 = widget.getParent().lookupWidget("password").getValue(); var
pass2 = widget.getValue();
java.lang.System.out.println("passwordretyped: pass1 = " + pass1 +
" pass2 = " + pass2); if
(pass1.equals(pass2) == false ) { var
i18nMessage = new
Packages.org.apache.cocoon.forms.util.I18nMessage("someErrorMsg",
"tt"); widget.setValidationError(new
Packages.org.apache.cocoon.forms.validation.ValidationError(i18nMessage)); return
false; } return
true; </fd:_javascript_> <!-- fd:assert
test="passwordretyped = password">
<fd:failmessage><i18n:text
i18n:key="register.passwordretyped.notok">Wachtwoorden zijn niet
identiek</i18n:text></fd:failmessage>
</fd:assert --> </fd:validation>
</fd:field> |
