Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6757685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:41:01+00:00 2026-05-26T13:41:01+00:00

I have a wicket form which contains many TextField input components. There’s a Validator

  • 0

I have a wicket form which contains many TextField input components. There’s a Validator attached to most of these inputs.

Suppose I’ve entered 50 values, and one of those fails a range validator. Wicket then generates an error feedback message, but also does not update the models associated with each component. Result is that I lose all 50 values I just entered, and have to type them in again.

My question is, can I tell Wicket to update the models of those components which had valid values, but just report an error for the bad value?

Digging around in the framwork, I noticed this code fragment in FormComponent, which seems to be indicating that if there is an error, then don’t update the model.

public final void processInput()
{
    inputChanged();
    validate();
    if (hasErrorMessage())
    {
        invalid();
    }
    else
    {
        valid();
        updateModel();
    }
}

Is there any way to customise this behaviour, and achieve my aim of retaining all valid values?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:41:02+00:00Added an answer on May 26, 2026 at 1:41 pm

    I’d bet that FormComponent.processInput() is not being called at all here. When you submit the Form, Form.process() gets called. There, it will call Form.validate(), which in turn will call Form.validateComponents(), ultimately using FormComponent.validate().

    The problem you’re having here is the global handling in Form.process(). The form submits fully, or not at all. When a FormComponent.validate() fails, Form.hasError() will return true, and therefore Form.process() will never update any of the models.

    You could:

    • Move all FormComponent independent validations to a FormValidator. There you can choose to update the Models of those FormComponents that pass their validations.
    • Implement Form.onError() and use a visitor there to update the models of valid FormComponents.
    • Override Form.process() and modify the // If a validation error occurred branch to use your own methods to mark components as valid/invalid, and update (or not) model objects, depending on the FormComponent having errors. FormComponent.hasErrorMessage() will tell you if validation failed on a certain FormComponent.

    UPDATE

    After discussing the reasons why user input was lost with the OP, it turned out that the FormComponents were being added in a ListView that did not have setReuseItems set to true. This was causing FormComponents to be created anew on each ListView.populateItem(), therefore losing all user input.

    More information on the nature of this problem can be found here:

    There are however a few provisions you have to take care of when using
    a repeater in the form. Usually repeaters clear out their items at the
    beginning of every request, when inside a form this is usually
    undesirable because you want to preserve the old items because you
    want them to keep their state as opposed to being recreated fresh.

    For example, if you use ListView, you should call
    ListView.setReuseItems(true) inside the form so that it preserves old
    items instead of always creating new ones everytime.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a wicket page , which contains two Spring-managed beans , one is
i have a web site which is created by wicket(java) but in special cases
I am new to Wicket framework, I have seen many good reviews on this
I have a wicket form containing a FileUploadField and some more text fields. When
I have a Wicket AuthenticatedWebApplication which has several pages and features that need to
In a Wicket app, I have a decimal number text field: TextField<BigDecimal> f =
I have a modal dialog in Wicket that contains a link. I need to
In Wicket, I'd like to subclass TextField form component to add additional markup around
I have a wicket application which can be deployed in different environments. One of
I occasionally have some long running AJAX requests in my Wicket application. When this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.