This works. I used tapestry-kaptcha module from T5.3 and the kaptcha jar from 
com.google.code.kaptcha in the classpath…

                <form t:type="Form">
                        Type the code shown below 
                        <t:KaptchaField t:image="kaptchaImage"/> 
                        <input type="submit"/>
                        <br/><br/>
                        <t:KaptchaImage t:id="kaptchaImage"/>
                </form>


import org.apache.tapestry5.annotations.InjectPage;

public class Page1 {

        // Other pages

        @InjectPage
        private Page2 page2;

        // The code

        Object onSuccess() {
                return page2;
        }
}

HTH,

Geoff

On 22/11/2011, at 11:09 PM, Taha Hafeez Siddiqi wrote:

> Hi
> 
> Are you including tapestry-kaptcha as a separate dependency. Kaptcha is not 
> available in tapestry-core
> 
> regards
> Taha
> 
> On Nov 22, 2011, at 3:25 PM, captain_rhino wrote:
> 
>> I might be going mad but how do I use the 
>> 
>> org.apache.tapestry5.kaptcha.components.KaptchaField
>> org.apache.tapestry5.kaptcha.components.KaptchaImage
>> 
>> component.  I can see the API docs but is there an example and none of the
>> compenents aoppear in my project?  Any examples would be appreciated?
>> 
>> I do have the tapx component available in my project.  But the validation of
>> the input always fails? 
>> 
>> Tml
>> <form t:id="kaptchaForm">
>>      <t:errors/>
>>      <div t:id="kaptchaImage"/>
>>      <div t:id="kaptchaComponent" image="kaptchaImage"/>
>>      <input type="submit"/>
>> </form>
>> 
>> Page
>> import com.howardlewisship.tapx.core.components.KaptchaField;
>> import com.howardlewisship.tapx.core.components.KaptchaImage;
>> 
>> public class TestKap {
>> 
>>      @Persist
>>      @Property
>>      private boolean inputValue;
>> 
>>      @Component
>>      private Form kaptchaForm;
>> 
>>      @Component 
>>      private KaptchaImage kaptchaImage;
>>      
>>      @Component(parameters = {"value=inputValue","image=kaptchaImage"})
>>      private KaptchaField kaptchaComponent;
>> 
>>      public boolean onValidateForm()
>>      {
>>              boolean goodValidation = true;
>> 
>>              if (!inputValue)
>>              {
>>                      kaptchaForm.recordError("kaptcha value not equals the 
>> user input!");
>>                      goodValidation = false;
>>              }
>> 
>>              return goodValidation;
>>      }
>>      
>> }
>> 
>> Any help/examples would be much appreciated.
>> 
>> --
>> View this message in context: 
>> http://tapestry.1045711.n5.nabble.com/kaptcha-tp5013121p5013121.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 

Reply via email to