addjavascript cannot add <script>function(...</script> which is what you need, it can only add _javascript_ that is to be executed on the server during the processing of the ajax request. what you need is what will be coming into 1.3 and is already in 2.0 - which is header contributions working in ajax.

-Igor


On 9/11/06, Pierre-Yves Saumont < [EMAIL PROTECTED]> wrote:
This might be a better solution than the one I figured (placing the
script in the head element. The problem with placing the script in the
head element is that there will be one specific _javascript_ function for
each form in the page, and the number of potential forms can be quite
high, due to the fact that the page contains a 7 tabs tabbed panel, each
panel can contains another tab panel with as many tabs, and each tab can
contain 1 to 3 forms. That makes around 100 fuctions which only differ
by the name of the component holding the onClick handler.

So using ajaxtarget.addjavascript() might certainly be simpler, if possible.

BTW, I would like to know how other developpers solve this use case:

- The user click on a link to delete a record displayed in a list view.
- The server marks the record to be deleted and put the current time in
a variable, then display the same page with a modal dialog asking for
confirmation.
- If the user clik yes, the server delete the record only if less that
15 seconds have elapsed.

Using a hand made dialog box (a div that is made visible only for this
use) is very easy. Using a _javascript_ confirm dialog is more difficult,
because the script that holds "if confirm('message')..." then load a url
that has to be created by Wicket.

My solution was to put invisible Ajax links in the page and call
onClick() on these. But I am pretty sure there is a much smarter
solution ;-)

BTW, the solution might be at a higher level, in choosing a different
strategy for record deletion confirmation ?

Pierre-Yves

Igor Vaynberg a écrit :
> this is a browser issue more then anything. it is prety difficult to get
> scripts loaded through ajax to execute. this will be fixed in 1.3 and is
> already implemented in 2.0 with lots of sweat and pain.
>
> meanwhile if you want wicket to execute some _javascript_ you can use
> ajaxtarget.addjavascript(), dont know if it helps your usecase.
>
> -Igor
>
>
> On 9/10/06, *Pierre-Yves Saumont* <[EMAIL PROTECTED] <mailto: [EMAIL PROTECTED]>>
> wrote:
>
>     I eventually figured where the problem was: in IE6, scripts that are
>     contained in Ajax responses seems not to be executed. If I place the
>     script in a component that is loaded normally (not through Ajax),
>     everthing is OK.
>
>     Is this problem a known issue with IE6 ?
>
>     In fact, I noticed some other strange behavior: If I place some HTML
>     code that is to produce a Wicket error, such as <wicket:head> inside a
>     <wicket:panel>, no error is detected if this code is loaded through
>     Ajax. Only if I reload the page (so that everything is loaded normally)
>     is the error detected.
>
>     Pierre-Yves
>
>     Pierre-Yves Saumont a écrit :
>      > Hello,
>      >
>      > I need to call the onClick event handler containing a Wicket
>     generated
>      > URL from a script. The id of the component holding the onClick event
>      > handler is
>      >
>     "rightColumn_pagePanel_dialogBoxReponses_tabs_panel_dialogBoxContent_confirmLink"
>      >
>      > On first page load, the event handler is:
>      >
>      > >>      >
>     wcall=wicketAjaxGet('/ceagrap/app?wicket:interface=:3:rightColumn:pagePanel:dialogBoxReponses:tabs:panel:dialogBoxContent:outside_partners:0:deleteGraphicButton::IBehaviorListener&wicket:behaviorId=0'
>
>      >
>      > I am calling it as follow:
>      >
>      >
>     document.getElementById("rightColumn_pagePanel_dialogBoxReponses_tabs_panel_dialogBoxContent_confirmLink").onclick();
>      >
>      > This works fine in Firefox but causes an error in IE6:
>      >
>      > ERROR: error while processing response: [object Error].Objet attendu
>      >   INFO: invoking failure handler...
>      >
>      > If I reload the page, the onClick handler change to:
>      >
>      > >>      >
>     wcall=wicketAjaxGet('/ceagrap/app?wicket:interface=:3:rightColumn:pagePanel:dialogBoxReponses:tabs:panel:dialogBoxContent:outside_partners:0:deleteGraphicButton:1:IBehaviorListener&wicket:behaviorId=0'
>      >
>      > and then it works fine event in IE6.
>      >
>      > The only difference between the two handler is:
>      >
>      > ...deleteGraphicButton::IBehaviorListener...
>      > ...deleteGraphicButton:1:IBehaviorListener...
>      >
>      > (Clicking on the link works in any case. Only calling it through
>      > _javascript_ make the first one fail)
>      >
>      > Does anyone know how to solve this problem?
>      >
>      > Pierre-Yves
>      >
>      >
>      >
>     -------------------------------------------------------------------------
>      > Using Tomcat but need to do more? Need to support web services,
>     security?
>      > Get stuff done quickly with pre-integrated technology to make
>     your job easier
>      > Download IBM WebSphere Application Server v.1.0.1 based on Apache
>     Geronimo
>      >
>     http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>     <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642>
>      > _______________________________________________
>      > Wicket-user mailing list
>      > Wicket-user@lists.sourceforge.net
>     <mailto: Wicket-user@lists.sourceforge.net>
>      > https://lists.sourceforge.net/lists/listinfo/wicket-user
>      >
>      >
>      >
>
>
>     -------------------------------------------------------------------------
>     Using Tomcat but need to do more? Need to support web services,
>     security?
>     Get stuff done quickly with pre-integrated technology to make your
>     job easier
>     Download IBM WebSphere Application Server v.1.0.1 based on Apache
>     Geronimo
>     http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>     <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >
>     _______________________________________________
>     Wicket-user mailing list
>     Wicket-user@lists.sourceforge.net
>     <mailto: Wicket-user@lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-develop mailing list
Wicket-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to