Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Model data lost when calling target.add before onSubmit

$
0
0
Hi,

I have two panels added to a form. The idea is to create a step 1, step 2 type functionality where after clicking next on panel 1, it hides and shows Panel 2.

I have a checkbox on Panel 1
add(new CheckBox("single", new PropertyModel(SelectionPanel.this, "single")));

and I have the following link
add(new AjaxLink("next") {
@Override
public void onClick(AjaxRequestTarget target) {
panel1.add(new AttributeModifier("style", new Model<String>("display:none")));
target.add(panel1);

JQueryEffectBehavior effectBehavior = new JQueryEffectBehavior("#panel2", "slide", slideOptions, 400);
target.appendJavaScript(effectBehavior.toString());
target.add(panel2);

});

I submit the form using AjaxButton on panel2 where I log out the PropertyModel data. The data shows the defaults for single in panel1 but is fine for any data in Panel2

I have narrowed it down to when I call target.add(panel1) in the onClick.

Does this call clear any Model data that has not been submitted?

Regards
Vishal

Viewing all articles
Browse latest Browse all 5648

Trending Articles