I have a test form based on a CompoundPropertyModel. Usually it works
great, but for some users, their answers are lost when they submit the
form. The problem is user-dependent, i.e. it always breaks for certain
users and it never breaks for the other users. If a user calls us with
this problem, we haven't been able to find anyway to get around it. I
haven't been able to replicate the problem on my computer. I posted
about this a few months ago, thinking it was a session problem, but now
I see that the problem happens right when the test is submitted. This is
with Wicket 1.3.4. Any ideas what would cause the model to lose the
information for certain users?

 

public class TestPage

{

 

public TestPage() {

add(new TestForm("testForm", new
CompoundPropertyModel(getSession().getUser().getTest())));        

}

      

public TestForm(final String id, CompoundPropertyModel testModel) {

            super(id, testModel);

                  

            add(new ListView("questions") {

                        

                  @Override

                  public boolean getReuseItems() {

                        return true;

                  }

 

                  protected void populateItem(ListItem item) {

 

                    final Question question = (Question)
item.getModelObject();        

                          

                    FoodHandlerRadioChoice answersRadioChoice = new
FoodHandlerRadioChoice("answers", 

                                                      new
PropertyModel(question, "markedAnswer"), 

 
question.getAnswers());

                    answersRadioChoice.setRequired(true);


                    item.add(answersRadioChoice);       

       

                }                   

            });

      }

            

      protected void onSubmit() {

            // The following should return an object. Usually it does,
but sometimes

            // it just returns null. Oh why, oh why? 

 
getSession().getUser().getTest().getQuestions().get(0).getMarkedAnswer()
;

            setResponsePage(TestResultsPage.class);

      }

}     

            

Reply via email to