cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Madu" <andrewm...@gmail.com>
Subject Re: captcha validation & fd:failmessage
Date Tue, 11 Jul 2006 12:45:56 GMT
Hi Marco,
I do the same but using flowscript like so:

    <fd:validation>
        <fd:javascript>
            var success = true;
            var captcha_code = widget.lookupWidget("captcha_code");
            var captcha_generated = cocoon.session.getAttribute("captcha");
            var parameters = {"supplied": captcha_code.value, "expected":
captcha_generated};

            try {

                   if
(parameters['supplied'].equals(parameters['expected'])) {
                        cocoon.session.setAttribute("user", checkUserTest);
                    } else {
                        captcha_code.setValidationError(new
Packages.org.apache.cocoon.forms.validation.ValidationError("The string you
entered is incorrect. Please re-enter.", false));
                        success = false;
                    }


HTH

Andrew


On 11/07/06, 321los@gmail.com <321los@gmail.com> wrote:
>
> Hello,
>
> my aim is to use captcha validation on forms, including a custom
> failmessage.
> My try was like that:
>
>
> <fd:captcha id="capt" required="true" length="5">
>       <fd:help>case sensitive!</fd:help>
>       <fd:datatype base="string"/>
>       <fd:validation>
>         <fd:captcha>
>             <fd:failmessage>Wrong! Try again</fd:failmessage>
>         </fd:captcha>
>       </fd:validation>
> </fd:captcha>
>
>
> but the displayed error message still is "validation.captcha.mismatch"
> Whats my mistake?
>
> Thanks for your help
> Marco
>
>

Mime
View raw message