It seems that Lable use < s p a n > tag while TextField use < i n p u t > tag 
and that they conflict. I have changed the code like this and it still does
not work properly. Does anyone have any  workaround ? Thank you!

public class Login extends WebPage {
        private int count = 0;
        
        Label label = null;
        TextField textField = null;

        public Login() {
                super();
                
                label = new Label("label", new PropertyModel(this, "count"));
                label.setOutputMarkupId(true);

                textField = new TextField("label", new PropertyModel(this, 
"count"));
                textField.setOutputMarkupId(true);              

                AjaxLink ajaxLink = new AjaxLink("ajaxLink") {
                        public void onClick(AjaxRequestTarget request) {
                                count++;
                                
                                if (count % 2 == 0)
                                {
                                        this.findPage().replace(label);
                                        request.addComponent(label);            
                        
                                }
                                else
                                {
                                        this.findPage().replace(textField);
                                        request.addComponent(textField);        
                                
                                }                               
                        }
                };

                this.add(label);
                this.add(ajaxLink);
        }

        public int getCount() {
                return count;
        }

        public void setCount(int count) {
                this.count = count;
        }
}
-- 
View this message in context: 
http://www.nabble.com/How-can-we-change-a-component-dynamically-in-Wicket---tf3956267.html#a11227330
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