Hello Again! I have a form that I build dynamically based on a render parameter value. I'm using http://cwiki.apache.org/WICKET/forms-with-dynamic-elements.html
I use the constructor: /** * Constructor */ public ViewModePage() { ... // Get render parameter String value = ((PortletRequestContext)RequestContext.get()).getPortletRequest().getParameter("crmportal:userId"); ... // Check for a valid answer from this customer if(value!=null && value.length()>0) { log.debug("Value length: " + value.length()); User user = userDAOBean.find(UuidUserType.fromString(value)); if(user!=null) { answer = getLastAnswer(1,user); if(answer!=null) { buildForm(answer); surveySubmitButton.setEnabled(true); } } } ... } ------------------------------------------------------------------------------------ buildForm(answer); gets the form build based on the user answer The problem as you can figure out. It works as I do nothing with the form... But when I submit the form the constructer gets not called anymore. So no matter what's the value it will get not updated to the new one. The GREAT book "wicket in action" explained this issue well. You have to use dynamic models: ---------------------------- CODE ---------------------------------- In chapter 4, we’ll discuss the differences between static models and dynamic mod- els (the issue at hand) in greater depth. For now, we’ll solve the problem by providing the label with a model that calculates its value every time it’s requested: add(new Label("total", new Model() { @Override public Object getObject() { NumberFormat nf = NumberFormat.getCurrencyInstance(); return nf.format(getCart().getTotal()); } })); -------------------WICKET IN ACTION ---------------------------- But as I have to build the form I do not have a dynamic model on page. So how do I make the form gets updated each time the page it's rendered without disturbing Wicket normal behaviour? Do I explain myself? Thank you all in advance.