Re: Model data lost when calling target.add before onSubmit

2014-07-07 Thread vp143
Many thanks!
I solved my original issue using AjaxWizardButtonBar which I was not aware
of as I was using an older version of Wicket.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Model-data-lost-when-calling-target-add-before-onSubmit-tp4666385p4666458.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Model data lost when calling target.add before onSubmit

2014-06-26 Thread Martin Grigorov
Hi,

The browser doesn't send any data for form elements which are not visible.
When clicking the AjaxLink you make panel1 invisible (display:none). The
following form submit submits only the visible form elements, thus empty
value is set to the checkbox's model.

Martin Grigorov
Wicket Training and Consulting


On Wed, Jun 25, 2014 at 11:32 PM, Vishal Popat vishal.po...@cipriati.co.uk
wrote:

 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 ModelString(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
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Model data lost when calling target.add before onSubmit

2014-06-25 Thread Vishal Popat
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 
ModelString(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
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org