Chapter 6. Processing user input using forms

 

In this chapter:

  • How Wicket processes HTML forms
  • Creating HTML forms with Wicket components
  • Submitting forms using Ajax
  • Validating user input with validators
  • Providing feedback to users

In the previous chapter, we discussed several ingredients for lasagna. But for a recipe to be complete, it needs a set of directions for creating the lasagna. Steps in our particular recipe include preheating the oven, cooking the lasagna sauce (don’t be shy with the garlic!), layering the lasagna in the oven dish, and letting it simmer in the oven for half an hour at 190°C (375°F).

Working with forms is like following a set of directions. First, you need to add a form and form components. Next, you must be able to react when user input is sent to the server. You need to validate that the input is correct, or at least be in the format you want. And finally, you should provide feedback to the user when the input is incorrect.

In this chapter we’ll discuss forms and how they’re processed. We’ll look at the various form components you can use to receive input from your users. You’ll learn different ways to submit the form using buttons, links, and Ajax. We’ll show you how you can validate user input and, finally, how you can give feedback.

We have to cover a lot of topics, so it isn’t surprising that this is a long chapter. Let’s get started.

6.1. What are forms?

6.2. How does form processing work?

6.3. Components for text input

6.4. Selecting from a list of items

6.5. Components for submitting form data

6.6. Validating user input

6.7. Providing feedback

6.8. Summary

sitemap