[ 
https://issues.apache.org/jira/browse/WICKET-1391?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Igor Vaynberg updated WICKET-1391:
----------------------------------

    Fix Version/s:     (was: 1.3.3)
                   1.5-M1

the patch is rather ugly and there is really no way to do this properly within 
1.3.1

for 1.5 the idea is to create a true "transparent"/nvisible container that can 
actually insert itself in between the children properly but be invisible as far 
user getparent/add/get/iterator/traversals are concerned. the 
visibleinhierarchy call can then take these invisible containers's visibility 
into account.

so an enclosure resolver will actualy insert an invisible container as a 
non-auto component into the hierarchy and then move all the children that are 
inside this enclosure into this container

so instead of it looking like this (textfield is inside an enclosure)

parent->form->textfield
parent->enclosure

it will look like this
parent->form->transparent container->textfield

> <wicket:enclosure> bug: setObject(null) called for excplicitly invisible 
> fields in a non-visible enclosure
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-1391
>                 URL: https://issues.apache.org/jira/browse/WICKET-1391
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.1
>            Reporter: Edvin Syse
>            Assignee: Igor Vaynberg
>             Fix For: 1.5-M1
>
>         Attachments: myproject.zip, wicket-1391-draft.patch.txt
>
>
> It seems that the value for fields that are made invisible because a 
> surrounding enclosure is actually lost on submit of the form.
> Consider the following code:
> public class HomePage extends WebPage {
>     private MyObject myObject;
>     
>     public HomePage(final PageParameters parameters) {
>         myObject = new MyObject();
>         myObject.setField1("field1Value");
>         myObject.setField2("field2Value");
>        
>     Form f = new Form("f", new CompoundPropertyModel(myObject));
>         add(f);
>         f.add(new TextField("field1").setVisible(false));
>         f.add(new TextField("field2"));
>        
>         f.add(new Button("submit") {
>             @Override public void onSubmit() {
>                 System.out.println("Field 2 value should be 'field2Value' but 
> is : " + myObject.getField2());
>             }
>         });
>     }
>     class MyObject implements Serializable {
>         private String field1;
>         private String field2;
>        
>         public String getField1() {
>             return field1;
>         }
>         public void setField1(String field1) {
>             this.field1 = field1;
>         }
>         public String getField2() {
>             return field2;
>         }
>         public void setField2(String field2) {
>             this.field2 = field2;
>         }
>     }
> }
> With the following markup:
> <form wicket:id="f">
>     <wicket:enclosure child="field1">
>          <input type="text" wicket:id="field1"/>
>          <input type="text" wicket:id="field2"/>
>     </wicket:enclosure>
>     <input type="submit" wicket:id="submit"/>
> </form>
> Field1 keeps it's value onSubmit, but the value for field2 is lost, and my 
> model object has null in field2. If I implicitly call setVisible(false) on 
> the TextField for field2, the value is kept onSubmit.
> Igor put better like this I guess:
> when the page renders none of the fields are shown. after submit,
> however, myobject.getfield1() is still "field1value" but
> myobject.getfield2() is null - which implies that textfield2 is still
> processed even though it is inside an enclosure that has been hidden.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to