I am trying to setVisible on a Fragment using the
AjaxFormComponentUpdatingBehavior object.
It doesn't seem to work.  I've also tried this with a Panel and that's not
working either.

However, if I use a component, like a TextField, that works.

In my java, this is the pertinent code for my Form:

DropDownChoice dropDown = new DropDownChoice("dropDown", new Model(""),
choiceList);
                        add(dropDown);

final WebMarkupContainer container = new WebMarkupContainer("container");
                        container.setOutputMarkupId(true);
                        
                        final Text2Fragment text2Fragment = new 
Text2Fragment("text2Fragment",
"text2FragmentId");
                        container.add(text2Fragment);
                        add(container);

                        dropDown.add(new 
AjaxFormComponentUpdatingBehavior("onchange")
                        {
                                protected void onUpdate(AjaxRequestTarget 
target)
                                {
                                        
                                        target.addComponent(container);
                                        text2Fragment.setVisible(false);
                                }
                        });             

My fragment:
private class Text2Fragment extends Fragment
{
        public Text2Fragment(String id, String markupId)
        {
                super(id, markupId);
                TextField text2 = new TextField("text2");
                add(text2);
        }
}



My HTML:
                                <tr>
                                        <td>DropDown:</td>
                                        <td><select wicket:id = 
"dropDown"></select></td>
                                </tr>                           
                                <tr>
                                        <td>Text 1</td>
                                        <td><input wicket:id="text1"></td>
                                </tr>
--spaces in span are for nabble                         
                                <sp an wicket:id="container" >
                                        <sp an wicket:id="text2Fragment"></sp 
an>
                                </sp an>
                                
                                <tr>
                                        <td>Text 3</td>
                                        <td><input wicket:id="text3"></td>
                                </tr>

My Fragment:

<wicket:fragment wicket:id="text2FragmentId">
        <tr>
                <td>Text 2</td>
                <td><input wicket:id="text2"></td>
        </tr>
</wicket:fragment>

If I put the text2 TextField in place of the fragment, the control
successfully
disappears.  I want a fragment so I can also remove labels, et al.

I'd appreciate any feedback on what I'm doing wrong.


-- 
View this message in context: 
http://www.nabble.com/setVisible-on-Fragment-with-AjaxFormComponentUpdatingBehavior-tf3800038.html#a10751154
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to