4 Replies Latest reply on Aug 15, 2007 6:32 AM by wise_guybg

    Captcha - custom message

    pmilner

      Hi,
      how can I localize the captcha response message for different languages? At the moment I get "input characters did not match", in case my response is incorrect, whatever the language the rest of the interface is in...
      There appears to be a way to annotate the CaptchaResponse with a custom message
      (http://docs.jboss.com/seam/1.2.1.GA/api/org/jboss/seam/captcha/CaptchaResponse.html)
      but I can't see how to make it work.
      Any advice greatly appreciated.
      Thanks,
      Paul

        • 1. Re: Captcha - custom message
          michael.c.small

          I was looking to do the same thing but didn't even realize that the CaptchaResponse annotation existed. My guess is that you need to create a getter method (with above annotation) on the Seam Component that handles the form you are associating the captcha input with.

          Because I was unaware of the annotation, I found another solution. If you are using the <s:validate/>/<s:decorate> in combination with the <h:inputText/> for the captcha input, you can use a custom message from your own message bundle:

          <s:decorate id="captchaDecor">
           <h:inputText value="#{captcah.response}" required="true">
           <s:validate/>
           </h:inputText>
           <s:span rendered="#{invalid}">
           <h:outputText value="#{messages.invalidCaptcha}"/>
           </s:span>
          </s:decorate>
          


          Note that "invalidCaptcha" should be whatever you named your property in your message bundle.

          • 2. Re: Captcha - custom message
            pmilner

            Thanks Michael -
            I'd already tried to add a getter method to the bean and couldn't get it work, but your second suggestion of using the customised s:validate message works really well.
            Cheers
            Paul

            • 3. Re: Captcha - custom message
              gavin.king

              Please add a feature request to JIRA, this should be more easy to override.

              • 4. Re: Captcha - custom message
                wise_guybg