wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Artur <a_wron...@gazeta.pl>
Subject Behavior.renderHead stopped working after migration from 1.4 to 6.5
Date Thu, 14 Feb 2013 13:41:32 GMT
Hi Guys,

We just migrated our code to W6.5 and are very happy about it.
Unfortunately we don't know how to fix one of the errors.

We did a research but cannot find a solution :(

The code adds a link before a component with some javascript:

             private class ChangeDateBehavior extends Behavior {
   [...]
                 @Override
                 public void renderHead(Component component, 
IHeaderResponse response) {
                     if 
(RequestCycle.get().find(AjaxRequestTarget.class) != null) {
                         String javascript = "var e = Wicket.$('" + 
getMarkupId()
                                 + "'); if (e != null && 
typeof(e.parentNode) != 'undefined') e.parentNode.removeChild(e);";
response.render(JavaScriptHeaderItem.forScript(javascript, null));
                     }
                     String tag = "<a id=\"" + getMarkupId() + 
"\"href=\"#\" onclick=\"changeDate('" + component.getMarkupId()
                         + "', " + Integer.toString(days) + ")\">" + txt 
+ "";
response.render(JavaScriptHeaderItem.forScript(tag, null));

                 }

                 @Override
                 public void bind(Component component) {
                     this.component = component;
                 }

                 public String getMarkupId() {
                     return component.getMarkupId() + "--" + id;
                 }

             }


And the error msg from the console:
ERROR: Wicket.Head.Contributor.processScript: SyntaxError: syntax error: 
eval -> <a id="from2059--lt"href="#" onclick="changeDate('from2059', 
-1)"><<\/a>


Thanks for help in advance,
Artur

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


Mime
View raw message