I have a simple register page with a captcha image and I offer the user an option to get a different captcha image. At first I just tried reloading the page which gives me a new captcha image, but unfortunately the form is then cleared which would be unacceptable and annoying for a user.
How would you solve this issue? If I submit the form from the “new image” link the wicket posting process will return with all sorts of validation errors before it reaches my onSubmit function which is also not good behaviour.
I guess I could also add ajax partial reloading of the captcha image although that is a more complex solution. Any pointers to a good and clean solution would be nice.
You can submit the form in your “new image” link by making it either a
Buttonor a[Ajax]SubmitLink. Then you can skip everything but the link’sonSubmitmethod by callingsetDefaultFormProcessing(false)on that link:This will cause everything to be submitted (and retained for the next render) but it will skip conversion of values, validation, and model updating.