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]

Reply via email to