Can you share the final solution?
From: Per Newgro <per.new...@gmx.ch> To: users@wicket.apache.org Date: 10/12/2010 01:37 PM Subject: Re: Can i execute an inline-javascript added to head for replaced panel on ajax-response? Jeeehhaa. Thanks alot Igor. That did it. Both tips together work as expected. Cheers Per > call setoutputmarkupid(true) on your label > > -igor > > > On Tue, Oct 12, 2010 at 10:14 AM, Per Newgro<per.new...@gmx.ch> wrote: >> Thanks Igor, >> >> but it didn't work. It seems that my label has no id in the response and >> thus the script can't find the element. >> >> <div> >> <span>Done</span> >> </div> >> >> This should be "lblReplaced3" after the ajax-refresh. Do i have to do >> something special for using replace with ajax? >> >> Thanks >> Per >> >> >> Here is the response >> *INFO: *focus set on doReplace2 >> *INFO: *Using XMLHttpRequest transport >> *INFO: * >> *INFO: *Initiating Ajax GET request on >> ?wicket:interface=:0:main:doReplace::IBehaviorListener:0:&random=0.27541138352960803 >> *INFO: *Invoking pre-call handler(s)... >> *INFO: *Received ajax response (1202 characters) >> *INFO: * >> <?xml version="1.0" encoding="UTF-8"?><ajax-response><header-contribution >> encoding="wicket1"><![CDATA[<head >> xmlns:wicket="http://wicket.apache.org"><script type="text/javascript" >> src="resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js"></script> >> <script type="text/javascript" >> src="resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js"></script> >> <script type="text/javascript" >> src="resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js"></script> >> <script type="text/javascript" >> id="wicket-ajax-debug-enable"><!--/*--><![CDATA[/*><!--*/ >> wicketAjaxDebugEnable=true; >> /*-->]^]^>*/</script> >> >> </head>]]></header-contribution><component id="main1" encoding="wicket1" >>> <![CDATA[<div id="main1"> >> <div> >> <span>Done</span> >> </div> >> <a id="doReplace2" href="#" onclick="var >> wcall=wicketAjaxGet('?wicket:interface=:0:main:doReplace::IBehaviorListener:0:-1',function() >> { }.bind(this),function() { }.bind(this), function() {return >> Wicket.$('doReplace2') != null;}.bind(this));return !wcall;">[Link]^</a> >> </div>]]></component><evaluate><![CDATA[document.getElementById("lblReplaced3").style.color="red";]]></evaluate></ajax-response> >> *INFO: *Response parsed. Now invoking steps... >> *INFO: *returned focused element: http://localhost:8080/# >> *INFO: *returned focused element: http://localhost:8080/# >> *ERROR: *Wicket.Ajax.Call.processEvaluation: Exception evaluating >> javascript: TypeError: document.getElementById("lblReplaced3") is null >> *INFO: *Response processed successfully. >> *INFO: *Invoking post-call handler(s)... >> *INFO: *Calling focus on doReplace2 >> *INFO: *focus set on doReplace2 >> *INFO: *focus removed from doReplace2 >> *INFO: *focus set on wicketDebugLink >> *INFO: *focus removed from wicketDebugLink >> >>> use renderondomreadyjavascript >>> >>> -igor >>> >> > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org Notice: This communication, including any attachments, is intended solely for the use of the individual or entity to which it is addressed. This communication may contain information that is protected from disclosure under State and/or Federal law. Please notify the sender immediately if you have received this communication in error and delete this email from your system. If you are not the intended recipient, you are requested not to disclose, copy, distribute or take any action in reliance on the contents of this information.