-1

My code looks like this

html

< div wicket:id="metroEthernetChildchkLeft">

java code

initializing CheckBoxMultipleChoice in constructor and then later setting the values of list and model using setter methods

class <some name>

   private CheckBoxMultipleChoice<String> metroEthernetChildchkLeft;

   <constructor>()
    {    metroEthernetChildchkLeft = new CheckBoxMultipleChoice<String>("metroEthernetChildchkLeft");
         metroEthernetChildchkLeft.setMarkupId("metroEthernetChildchkLeftId");
         metroEthernetChildchkLeft.add(AttributeModifier.prepend("load", "javascript:addMargin(metroEthernetChildchkLeftId);"));
         metroEthernetChildchkLeft.setEnabled(false);
         commentTechSpeedMetroEthernetListView.add(metroEthernetChildchkLeft);

          add(new IndicatingAjaxButton("submitChoiceCmd")
            {
               private static final long serialVersionUID = 1L;

               @Override
               protected void onSubmit(AjaxRequestTarget target, Form< ? > form)
               {
               //// >>>>>>>> updated model value is not coming here <<<<<<
                meSpeedSelectLeft = (ArrayList<String>) metaCommentTechSpeedBean.getMeSpeedSelectLeft();
               });
    }    

    method()
    {
        meSpeedSelectLeft = (ArrayList<String>) metaCommentTechSpeedBean.getMeSpeedSelectLeft();

        leasedLineChildDivLeft.setDefaultModel(new PropertyModel(metaCommentTechSpeedBean, "llSpeedSelectLeft"));
        leasedLineChildDivLeft.setChoices(llSpeedListLeft);
    }

i am not able to get checked values [array list of selected checkboxes] in submit method {located in constructor}

Updated :

<div wicket:id="metroEthernetChildchkLeft"></div>

  public class MetaCommentTechSpeedChoiceForm extends OForm<MetaCommentTechSpeedBean>
   {

        private CheckBoxMultipleChoice<String> metroEthernetChildchkLeft;

  public MetaCommentTechSpeedChoiceForm(String id)
    {    

          super(id);
                metroEthernetChildchkLeft = new CheckBoxMultipleChoice<String>("metroEthernetChildchkLeft");
                metroEthernetChildchkLeft.setMarkupId("metroEthernetChildchkLeftId");
                metroEthernetChildchkLeft.add(AttributeModifier.prepend("load", "javascript:addMargin(metroEthernetChildchkLeftId);"));
                metroEthernetChildchkLeft.setEnabled(false);
                commentTechSpeedMetroEthernetListView.add(metroEthernetChildchkLeft);

                add(new IndicatingAjaxButton("submitChoiceCmd")
                {
                    private static final long serialVersionUID = 1L;

                    @Override
                    protected void onSubmit(AjaxRequestTarget target, Form< ? > form)
                    {

                            meSpeedSelectLeft = (ArrayList<String>) metaCommentTechSpeedBean.getMeSpeedSelectLeft(); //// >>>>>>>> updated model value is not coming here <<<<<<
                    });
    }    

    public void formFunction(final MetaCommentCreationBean metaCommentCreationBean, final Component basicInfoContainer, final Component techSpeedSettingsContainer)
    {
            meSpeedSelectLeft = (ArrayList<String>) metaCommentTechSpeedBean.getMeSpeedSelectLeft();
            leasedLineChildDivLeft.setDefaultModel(new PropertyModel(metaCommentTechSpeedBean, "llSpeedSelectLeft"));
            leasedLineChildDivLeft.setChoices(llSpeedListLeft);
    }
Don Roby
  • 40,677
  • 6
  • 91
  • 113
atom217
  • 971
  • 1
  • 14
  • 26
  • Post real code please. – Don Roby Jun 20 '14 at 13:43
  • @DonRoby real code http://pastebin.com/AFgkPAz0 ; of java file ; please give little hint what exactly you are looking for – atom217 Jun 20 '14 at 14:01
  • It is pretty much impossible to debug incomplete code such as you originally posted. Unfortunately 2000 lines of real code is not much better. Shorter but still real code exhibiting the problem would be much easier to deal with. See [SSCCE: How to provide examples for programming questions](http://meta.stackexchange.com/questions/22754/sscce-how-to-provide-examples-for-programming-questions) – Don Roby Jun 20 '14 at 14:20

1 Answers1

1

the problem occurred due to this line

metroEthernetChildchkLeft.setEnabled(false);

i disabled the control and enabling it on frontend using javascript.

Wicket still thinks that the control is disabled and hence not updating the model object.

atom217
  • 971
  • 1
  • 14
  • 26