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 4590922
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T22:19:15+00:00 2026-05-21T22:19:15+00:00

I am using wicket’s CheckBoxMultipleChoice to let the user set a list of options.

  • 0

I am using wicket’s CheckBoxMultipleChoice to let the user set a list of options. so far it works fine. but then i want to add a “check all” check box that checks all the options in the CheckBoxMultipleChoice and I am having problems with that.

here is my initial code

ArrayList<String> chosen;
List<String> choices = Arrays.asList(new String[]{"Train", "Bus", "Car"});  
CheckBoxMultipleChoice myCheck = new CheckBoxMultipleChoice("transport", new Model(chosen), choices)); 
myCheck.setOutputMarkupId(true);
form.add(myCheck);

on submit i print out the values of chosen and its “Bus”, “Car” etc. as expected.

now i am adding a checkbox to check all the choices using ajax:

Boolean checkOrNot;
final CheckBox checkAll = new CheckBox("checkAll", new Model(checkOrNot));  
form.add(checkAll);
checkAll.add(new AjaxFormComponentUpdatingBehavior("onchange") {

    @Override
    protected void onUpdate(AjaxRequestTarget target) {         
        // here i am not able to set the checkboxes 

        // i tried doing this
    chosen.clear();
    chosen.add(new String("Car"));
    chosen.add(new String("Train"));    
        myCheck.modelChanged();

        // i have also tried recreating the multiple choice     
        myCheck = new CheckBoxMultipleChoice<T>("transport", new Model(chosen), choices);

        myCheck.setOutputMarkupId(true);
        target.addComponent(myCgecj);
        target.addComponent(form);          
    }
});

I am running out of ideas and wondering if anyone has any solutions? thanks in advance for any help.

  • 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-21T22:19:16+00:00Added an answer on May 21, 2026 at 10:19 pm

    I didn’t (and can’t) try that right now, so this is to be taken with a grain of salt, but couldn’t you use a CheckGroup for that?

    From the JavaDoc:

    Component used to connect instances of Check components into a group. Instances of Check have to be in the component hierarchy somewhere below the group component. The model of the CheckGroup component has to be an instance of java.util.Collection. The model collection of the group is filled with model objects of all selected Check components.

    So a

    new Checkgroup("group", choices)
    

    should work for you. No need to reimplement that functionality.

    P.S.: I’ll check that as soon as I’ve got the chance to do so…

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

Sidebar

Related Questions

I am using the wicket 1.3 CheckBoxMultipleChoice() method to have the user select relevant
I'm new to website development using Java but I've got started with Wicket and
I'm using a ListMultipleChoice component in wicket and I want to get the selected
I'm using Wicket + EJB3 in an application and I face a problem but
I try to make form for user to register using Wicket. I got user
First I want to say I saw a site: https://cwiki.apache.org/WICKET/autocomplete-using-a-wicket-model.html Still I have some
I am using the DateTimeField component of Wicket, but I am struggling to apply
I'm updating a list using wicket. The list will be updated (ajax request is
I successfully created a project using Wicket quickstart and turned it into an Eclipse
I am currently working on a web app using Wicket and started using jQuery

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.