button click and Form with CompoundPropertyModel lose its data

2008-12-01 Thread itayh

Hi,

I am creating a form in the next format:
private abstract class EditForm extends Form{

   public EditForm(String id, Poll poll) {
/*
 * We wrap the poll bean with a CompoundPropertyModel, this
allows
 * us to easily connect form components to the bean properties
 * (component id is used as the property expression)
 */

super(id, new CompoundPropertyModel(poll));
 
  }
}

My page has also some buttons in different forms that do all kind of things.
My problem begin when I create new Poll object (so the poll is empty) and
fill the fields of the poll, but before saving it I press on one of the
other buttons. It is rendering the page again so all the  data that I enter
is lost.

Same problem occur when I edit poll and before saving it I press on one of
the other buttons. It is rendering the page again so all the  data that I
change is lost.

Any idea will be appreciate.

Thanks,
  Itay
-- 
View this message in context: 
http://www.nabble.com/button-click-and-Form-with-CompoundPropertyModel-lose-its-data-tp20767616p20767616.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: button click and Form with CompoundPropertyModel lose its data

2008-12-01 Thread Edvin Syse
If you create a new Poll object, there is no magic that will bind that 
to your form instead of the Poll object you wrapped in the 
CompoundPropertyModel.


You could put the poll object as a local field member in the class, and 
use PropertyModel(poll, property-expression) for the fields instead. 
That way you can swap out the poll-object and still keep the form in sync.


Alternatively you can apply the new Poll object to the form by doing:

form.setModel(new CompoundPropertyModel(newPollObject)) after you create 
the new one.


-- Edvin

itayh skrev:

Hi,

I am creating a form in the next format:
private abstract class EditForm extends Form{

   public EditForm(String id, Poll poll) {

/*
 * We wrap the poll bean with a CompoundPropertyModel, this
allows
 * us to easily connect form components to the bean properties
 * (component id is used as the property expression)
 */

	super(id, new CompoundPropertyModel(poll));

 
  }
}

My page has also some buttons in different forms that do all kind of things.
My problem begin when I create new Poll object (so the poll is empty) and
fill the fields of the poll, but before saving it I press on one of the
other buttons. It is rendering the page again so all the  data that I enter
is lost.

Same problem occur when I edit poll and before saving it I press on one of
the other buttons. It is rendering the page again so all the  data that I
change is lost.

Any idea will be appreciate.

Thanks,
  Itay
  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: button click and Form with CompoundPropertyModel lose its data

2008-12-01 Thread Igor Vaynberg
your buttons in different forms will submit the form they are in, so
you lose any input form any other form. this is how html works - only
one form can be submitted.

wicket supports embedded forms, so if you embed all your other forms
into one form the input should not be lost.

-igor

On Mon, Dec 1, 2008 at 12:11 AM, itayh [EMAIL PROTECTED] wrote:

 Hi,

 I am creating a form in the next format:
 private abstract class EditForm extends Form{

   public EditForm(String id, Poll poll) {
/*
 * We wrap the poll bean with a CompoundPropertyModel, this
 allows
 * us to easily connect form components to the bean properties
 * (component id is used as the property expression)
 */

super(id, new CompoundPropertyModel(poll));
 
  }
 }

 My page has also some buttons in different forms that do all kind of things.
 My problem begin when I create new Poll object (so the poll is empty) and
 fill the fields of the poll, but before saving it I press on one of the
 other buttons. It is rendering the page again so all the  data that I enter
 is lost.

 Same problem occur when I edit poll and before saving it I press on one of
 the other buttons. It is rendering the page again so all the  data that I
 change is lost.

 Any idea will be appreciate.

 Thanks,
  Itay
 --
 View this message in context: 
 http://www.nabble.com/button-click-and-Form-with-CompoundPropertyModel-lose-its-data-tp20767616p20767616.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: button click and Form with CompoundPropertyModel lose its data

2008-12-01 Thread Edvin Syse

I'm sorry, I see now that I misunderstood the question :)

-- Edvin

Igor Vaynberg skrev:

your buttons in different forms will submit the form they are in, so
you lose any input form any other form. this is how html works - only
one form can be submitted.

wicket supports embedded forms, so if you embed all your other forms
into one form the input should not be lost.

-igor

On Mon, Dec 1, 2008 at 12:11 AM, itayh [EMAIL PROTECTED] wrote:
  

Hi,

I am creating a form in the next format:
private abstract class EditForm extends Form{

  public EditForm(String id, Poll poll) {
   /*
* We wrap the poll bean with a CompoundPropertyModel, this
allows
* us to easily connect form components to the bean properties
* (component id is used as the property expression)
*/

   super(id, new CompoundPropertyModel(poll));

 }
}

My page has also some buttons in different forms that do all kind of things.
My problem begin when I create new Poll object (so the poll is empty) and
fill the fields of the poll, but before saving it I press on one of the
other buttons. It is rendering the page again so all the  data that I enter
is lost.

Same problem occur when I edit poll and before saving it I press on one of
the other buttons. It is rendering the page again so all the  data that I
change is lost.

Any idea will be appreciate.

Thanks,
 Itay
--
View this message in context: 
http://www.nabble.com/button-click-and-Form-with-CompoundPropertyModel-lose-its-data-tp20767616p20767616.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]