Delfino Gomes
Delfino Gomes

Reputation: 385

How to send multiple fields from one form using Wicket?

In my form a have some fields, and I need three of them to be filled before I run a query that searchs for an entity and update the form.
Is there any way to send this fields together in an ajax request, so I can run the query with the values send from the client and don't rely on values on the model?
I say this because I don't want that these values to be set in the model, since there are fields that are required, so if the user fills the field and later erase the previous value, wicket will not update the value on the model.

Upvotes: 1

Views: 707

Answers (1)

Nicktar
Nicktar

Reputation: 5575

Put them in a nested form, mark them required, add a AjaxFormComponentUpdatingBehavior and tie the fields to a temporary model.

In the onUpdate method check if all 3 values are set and if they are, run your query.

In the onSubmit of your main form transfer the values from your temporary model to the real one.

Upvotes: 2

Related Questions