Re: problem with PropertyModel and setDefaultFormProcessing(false) for button

2008-11-10 Thread Christopher Lyth
Have you tried to setDefaultFormProcessing to false and in the onSubmit of
the button reset the form model. Alternatively the add button could set the
model of the form to a new object every time.

On Sun, Nov 9, 2008 at 4:27 AM, itayh [EMAIL PROTECTED] wrote:


 Hi Timo,

 Changing it to link solve the problem, but created a new one. It changes
 the
 look and feel of my page (since I am using buttons for save and cancel in
 my
 site).

 Thank in advance,
  Itay


 Timo Rantalaiho wrote:
 
  On Tue, 28 Oct 2008, itayh wrote:
  I have a page that contain a hidden form. When the user press on Add
  Item
  or Edit Item then I set the visability of the form to true and the
 user
  can add details and the OK button save the data and set the visability
 of
  the form to false.
  The problem is if the user press on cancel. I need to set
  setDefaultFormProcessing(false) for the cancel button (since I don't
 want
  to
  do validation checks) but It cause the next problem:
  After the cancel press next time I press the Add Item or Edit Item
  the
  data that I see is the old data (The one I press cancel on)
  Changing setDefaultFormProcessing(true) for the cancel fix that problem.
 
  Maybe you could change the cancel button
 
  addItemForm.add(new Button(cancel, new Model(Cancel)) {
  public void onSubmit() {
   onCanceItem();
  }
  }.setDefaultFormProcessing(false));
 
  to be a Link in Wicket? That way it would definitely not
  submit any form data to the server, so nothing should be
  stored in between requests.
 
  Best wishes,
  Timo
 
  --
  Timo Rantalaiho
  Reaktor Innovations OyURL: http://www.ri.fi/ 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

 --
 View this message in context:
 http://www.nabble.com/problem-with-PropertyModel-and-setDefaultFormProcessing%28false%29-for-button-tp20209348p20404643.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]




-- 
Christopher J Lyth
[EMAIL PROTECTED]


Re: problem with PropertyModel and setDefaultFormProcessing(false) for button

2008-11-10 Thread itayh

Thank you all for all the help. Changing the type of the button to button
instead of submit fix that problem.

itayh wrote:
 
 The first line is actually name = item.getName(); there was a copy typo
 when I paste here the code. Any Idea?
 
 Pablo Abad wrote:
 
 Seems a typo either in the code you pasted or in your actual code, but
 shouldn't the first line be something like name = item.getName(); ?
 (gameItem -- item)
 On Tue, Oct 28, 2008 at 11:41 AM, itayh [EMAIL PROTECTED]
 wrote:
 
 protected void onEditItem(Item item) {
name = gameitem.getName();
addItemsForm.setVisible(true);
 }
   
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/problem-with-PropertyModel-and-setDefaultFormProcessing%28false%29-for-button-tp20209348p20419618.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: problem with PropertyModel and setDefaultFormProcessing(false) for button

2008-11-09 Thread itayh

Hi Timo,

Changing it to link solve the problem, but created a new one. It changes the
look and feel of my page (since I am using buttons for save and cancel in my
site).

Thank in advance,
  Itay


Timo Rantalaiho wrote:
 
 On Tue, 28 Oct 2008, itayh wrote:
 I have a page that contain a hidden form. When the user press on Add
 Item
 or Edit Item then I set the visability of the form to true and the user
 can add details and the OK button save the data and set the visability of
 the form to false.
 The problem is if the user press on cancel. I need to set
 setDefaultFormProcessing(false) for the cancel button (since I don't want
 to
 do validation checks) but It cause the next problem:
 After the cancel press next time I press the Add Item or Edit Item
 the
 data that I see is the old data (The one I press cancel on)
 Changing setDefaultFormProcessing(true) for the cancel fix that problem.
 
 Maybe you could change the cancel button
 
 addItemForm.add(new Button(cancel, new Model(Cancel)) {
 public void onSubmit() {
  onCanceItem();
 }
 }.setDefaultFormProcessing(false));
 
 to be a Link in Wicket? That way it would definitely not
 submit any form data to the server, so nothing should be
 stored in between requests.
 
 Best wishes,
 Timo
 
 -- 
 Timo Rantalaiho   
 Reaktor Innovations OyURL: http://www.ri.fi/ 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/problem-with-PropertyModel-and-setDefaultFormProcessing%28false%29-for-button-tp20209348p20404643.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: problem with PropertyModel and setDefaultFormProcessing(false) for button

2008-11-09 Thread jWeekend

Itay,

Link can be used with an anchor or a button (in fact, it can be used with
any element that supports the onclick javascript event handler).

Regards - Cemal
http://www.jWeekend.co.uk http://jWeekend.co.uk 



itayh wrote:
 
 Hi Timo,
 
 Changing it to link solve the problem, but created a new one. It changes
 the look and feel of my page (since I am using buttons for save and cancel
 in my site).
 
 Thank in advance,
   Itay
 
 
 Timo Rantalaiho wrote:
 
 On Tue, 28 Oct 2008, itayh wrote:
 I have a page that contain a hidden form. When the user press on Add
 Item
 or Edit Item then I set the visability of the form to true and the
 user
 can add details and the OK button save the data and set the visability
 of
 the form to false.
 The problem is if the user press on cancel. I need to set
 setDefaultFormProcessing(false) for the cancel button (since I don't
 want to
 do validation checks) but It cause the next problem:
 After the cancel press next time I press the Add Item or Edit Item
 the
 data that I see is the old data (The one I press cancel on)
 Changing setDefaultFormProcessing(true) for the cancel fix that problem.
 
 Maybe you could change the cancel button
 
 addItemForm.add(new Button(cancel, new Model(Cancel)) {
 public void onSubmit() {
 onCanceItem();
 }
 }.setDefaultFormProcessing(false));
 
 to be a Link in Wicket? That way it would definitely not
 submit any form data to the server, so nothing should be
 stored in between requests.
 
 Best wishes,
 Timo
 
 -- 
 Timo Rantalaiho   
 Reaktor Innovations OyURL: http://www.ri.fi/ 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/problem-with-PropertyModel-and-setDefaultFormProcessing%28false%29-for-button-tp20209348p20405449.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: problem with PropertyModel and setDefaultFormProcessing(false) for button

2008-10-30 Thread Timo Rantalaiho
On Tue, 28 Oct 2008, itayh wrote:
 I have a page that contain a hidden form. When the user press on Add Item
 or Edit Item then I set the visability of the form to true and the user
 can add details and the OK button save the data and set the visability of
 the form to false.
 The problem is if the user press on cancel. I need to set
 setDefaultFormProcessing(false) for the cancel button (since I don't want to
 do validation checks) but It cause the next problem:
 After the cancel press next time I press the Add Item or Edit Item the
 data that I see is the old data (The one I press cancel on)
 Changing setDefaultFormProcessing(true) for the cancel fix that problem.

Maybe you could change the cancel button

 addItemForm.add(new Button(cancel, new Model(Cancel)) {
 public void onSubmit() {
   onCanceItem();
 }
 }.setDefaultFormProcessing(false));

to be a Link in Wicket? That way it would definitely not
submit any form data to the server, so nothing should be
stored in between requests.

Best wishes,
Timo

-- 
Timo Rantalaiho   
Reaktor Innovations OyURL: http://www.ri.fi/ 

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



problem with PropertyModel and setDefaultFormProcessing(false) for button

2008-10-28 Thread itayh

Hey,

I have a page that contain a hidden form. When the user press on Add Item
or Edit Item then I set the visability of the form to true and the user
can add details and the OK button save the data and set the visability of
the form to false.
The problem is if the user press on cancel. I need to set
setDefaultFormProcessing(false) for the cancel button (since I don't want to
do validation checks) but It cause the next problem:
After the cancel press next time I press the Add Item or Edit Item the
data that I see is the old data (The one I press cancel on)
Changing setDefaultFormProcessing(true) for the cancel fix that problem.

Here is the code:

private String name;
TextField nameField = new TextField(name, new PropertyModel(this,
name));
addGameItemForm.add(nameField);

...

Link link = new Link(edit-link, item.getModel()) {
public void onClick() {
onEditItem((Item) getModelObject());
}
};

...

Button save = new Button(save, new Model(Save)) {
public void onSubmit() {
onSaveItem();
}
;   
addItemForm.add(save);

addItemForm.add(new Button(cancel, new Model(Cancel)) {
public void onSubmit() {
onCanceItem();
}
}.setDefaultFormProcessing(false));

private void onCancelGameItem() {
addItemsForm.setVisible(false);
}

protected void onEditItem(Item item) {
name = gameitem.getName();
addItemsForm.setVisible(true);
}

In case that the setDefaultFormProcessing is false for the cancel button,
the name is not the one I press edit on. It is the old one.

Any Idea?





-- 
View this message in context: 
http://www.nabble.com/problem-with-PropertyModel-and-setDefaultFormProcessing%28false%29-for-button-tp20209348p20209348.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: problem with PropertyModel and setDefaultFormProcessing(false) for button

2008-10-28 Thread James Carman
Set the name property to  in your cancel handler logic?

On Tue, Oct 28, 2008 at 11:41 AM, itayh [EMAIL PROTECTED] wrote:

 Hey,

 I have a page that contain a hidden form. When the user press on Add Item
 or Edit Item then I set the visability of the form to true and the user
 can add details and the OK button save the data and set the visability of
 the form to false.
 The problem is if the user press on cancel. I need to set
 setDefaultFormProcessing(false) for the cancel button (since I don't want to
 do validation checks) but It cause the next problem:
 After the cancel press next time I press the Add Item or Edit Item the
 data that I see is the old data (The one I press cancel on)
 Changing setDefaultFormProcessing(true) for the cancel fix that problem.

 Here is the code:

 private String name;
 TextField nameField = new TextField(name, new PropertyModel(this,
 name));
 addGameItemForm.add(nameField);

 ...

 Link link = new Link(edit-link, item.getModel()) {
public void onClick() {
onEditItem((Item) getModelObject());
}
 };

 ...

 Button save = new Button(save, new Model(Save)) {
public void onSubmit() {
onSaveItem();
}
 ;
 addItemForm.add(save);

 addItemForm.add(new Button(cancel, new Model(Cancel)) {
public void onSubmit() {
onCanceItem();
}
 }.setDefaultFormProcessing(false));

 private void onCancelGameItem() {
addItemsForm.setVisible(false);
 }

 protected void onEditItem(Item item) {
name = gameitem.getName();
addItemsForm.setVisible(true);
 }

 In case that the setDefaultFormProcessing is false for the cancel button,
 the name is not the one I press edit on. It is the old one.

 Any Idea?





 --
 View this message in context: 
 http://www.nabble.com/problem-with-PropertyModel-and-setDefaultFormProcessing%28false%29-for-button-tp20209348p20209348.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: problem with PropertyModel and setDefaultFormProcessing(false) for button

2008-10-28 Thread itayh

Did it. It has no affect. I clear the name in the cancel and I also set it to
the new value in edit item action. But still after cancel when i try to edit
new item I get the old value. 

jwcarman wrote:
 
 Set the name property to  in your cancel handler logic?
 
 On Tue, Oct 28, 2008 at 11:41 AM, itayh [EMAIL PROTECTED] wrote:

 Hey,

 I have a page that contain a hidden form. When the user press on Add
 Item
 or Edit Item then I set the visability of the form to true and the user
 can add details and the OK button save the data and set the visability of
 the form to false.
 The problem is if the user press on cancel. I need to set
 setDefaultFormProcessing(false) for the cancel button (since I don't want
 to
 do validation checks) but It cause the next problem:
 After the cancel press next time I press the Add Item or Edit Item
 the
 data that I see is the old data (The one I press cancel on)
 Changing setDefaultFormProcessing(true) for the cancel fix that problem.

 Here is the code:

 private String name;
 TextField nameField = new TextField(name, new PropertyModel(this,
 name));
 addGameItemForm.add(nameField);

 ...

 Link link = new Link(edit-link, item.getModel()) {
public void onClick() {
onEditItem((Item) getModelObject());
}
 };

 ...

 Button save = new Button(save, new Model(Save)) {
public void onSubmit() {
onSaveItem();
}
 ;
 addItemForm.add(save);

 addItemForm.add(new Button(cancel, new Model(Cancel)) {
public void onSubmit() {
onCanceItem();
}
 }.setDefaultFormProcessing(false));

 private void onCancelGameItem() {
addItemsForm.setVisible(false);
 }

 protected void onEditItem(Item item) {
name = gameitem.getName();
addItemsForm.setVisible(true);
 }

 In case that the setDefaultFormProcessing is false for the cancel button,
 the name is not the one I press edit on. It is the old one.

 Any Idea?





 --
 View this message in context:
 http://www.nabble.com/problem-with-PropertyModel-and-setDefaultFormProcessing%28false%29-for-button-tp20209348p20209348.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]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/problem-with-PropertyModel-and-setDefaultFormProcessing%28false%29-for-button-tp20209348p20210308.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: problem with PropertyModel and setDefaultFormProcessing(false) for button

2008-10-28 Thread Pablo Abad
Seems a typo either in the code you pasted or in your actual code, but
shouldn't the first line be something like name = item.getName(); ?
(gameItem -- item)
 On Tue, Oct 28, 2008 at 11:41 AM, itayh [EMAIL PROTECTED] wrote:
 
 protected void onEditItem(Item item) {
name = gameitem.getName();
addItemsForm.setVisible(true);
 }
   

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