Jukka Välimaa wrote:
Thank you for your time Jeromy,

I have confirmed that the problem with running javascript is actually
related to ajax tags. I placed the following script on my page:
<script type="text/javascript" >
alert('boo');
</script>

It refused to run until I removed the one <sx:div> section I had in the
page:
<sx:div id="pricingParams" href="%{#ajaxPricingUrl}"
        listenTopics="/reloadPricingParams"
indicator="pricingParamsIndicator"
        preload="true" executeScripts="true" separateScripts="true">
        <s:include value="ajaxPricing.jsp" />
    </sx:div>

After I removed that, the script worked fine. As far as I can tell, any ajax
tags, even a simple sx:a, stops scripts from running. At the moment, I'm
using a 2.1.1 snapshot version of the dojo plugin; do you recommend that I
change to another version? To another poster, you recommended not using ajax
tags.
hmm... I did something similar and confirmed that it was working. However, I used the bind tag rather than listenTopics, the target div was empty and I did not use the preload attribute. I recommend creating a small test application and trying it in isolation. I agree there is something wrong. When I get time I'll take another look. I used 2.1.1.
My code:

<s:submit value="Submit" id="submit3" />
<sx:bind targets="div1" highlightColor="#ffffcc" highlightDuration="500" sources="submit3" events="onclick" href="%{#fragment3Url}" errorNotifyTopics="/error" executeScripts="true" separateScripts="true"/>


Make sure you switch dojo over to use the uncompressed version via the head tag.

You can see the javascript code of the Bind widget is self-evident and that's why it works:

// no validation or validation passed
     if(this.executeScripts) {
       //parse text to extract content and javascript
       var parsed = this.parse(data);
//update targets content
       this.setContent(parsed.text);
//execute scripts
       this._executeScripts(parsed.scripts);
     }
     else {
       this.setContent(data);
     }

The operation of the div (bindDiv) is not so obvious however. It's nasty. I'd have to trace through it in your example to see where it gets to.

In general, this is why I don't like tags that hide the underlying client-side library. By using the javascript library directly you get a few better appreciation for how it works, it's much easier to debug and you can receive support from the library's community of developers. It's an illusion that the tags increase productivity because any non-trivial application will need to access the API of the underlying library eventually.

regards,
Jeromy Evans




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to