Hi

I migrated my application from Wicket 1.5.10 to 6.7

During testing I recognized that during an ajax update (replacement) of a
component, the markup of the component is twice in the HTML markup (the old
and the new markup). Thus the execution of javascript inside a component may
fail due to the fact, that two components with the same id are present in
the HTML markup.

EXAMPLE


*HTML:*
<a wicket:id="testlink">testlink</a>
<div wicket:id="testbox" style="width: 100px; height:
100px; border: 1px solid #ccc;">
        <script type="text/javascript">
                alert('hello');
        </script>
</div>

*JAVA:*
final WebMarkupContainer testbox = new WebMarkupContainer("testbox");
testbox.setOutputMarkupId(true);
add(testbox);

add(new AjaxLink<Void>("testlink") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
                target.add(testbox);
        }
});


So while the ajax update is processed the 'testbox' DIV and its javascript
are present twice (the old and new DIV). If the javascript is a little more
complex and for example changes stuff inside the DIV, the javascript will
change stuff in the old instead of the new DIV container.

My javascript relies on the fact, that an id should always be present just
once.

Why is the old DIV not removed first, before the new DIV is appended? Can I
change this behavior somehow?

Thanks in advance
Nico



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Component-twice-in-markup-while-ajax-refresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to