Mailing List Message #378
From: Markus Ruggiero (rucotec) <>
Subject: Re: [WO-DEV] ERXStyleSheet inside AjaxModalDialog
Date: Sat, 16 Jul 2022 13:00:25 +0200
To: WebObjects & WOnder Development <>
Signed Data (Text SHA256)

On 15 Jul 2022, at 19:54, Ralf Schuchardt <> wrote:

Hi Markus,

the Modalbox strips any script tags from the Ajax response before displaying the content.
But the scripts should still be evaluated in the current window context (modalbox.js lines 290 and 291). It seems to me the extractScript function only looks at the content of the tag, and it will not load anything remote, so your second example will probably not work.

Thanks for the explanation, helps a lot in understanding

I would try to include any scripts or css needed in the containing page or component. 

Probably the way to go. Wanted to have the modal dialog as self-contained as possible. Maybe creating a wrapper component around the modal dialog with all the necessary infrastructure and then add this one instead of the dialog directly? 
Need to try couple things out.

Thanks again for getting me out of my loop of thinking

ERXComponent has primaryJavascriptFile() and additinalJavascriptFiles() functions (and similar functions for CSS) to override in a component, that will dynamically insert corresponding script tags in the page header (but probably not when called with Ajax).


On 15 Jul 2022, at 15:48, Markus Ruggiero (rucotec) wrote:

It’s getting weirder and weirder. Similar thing happens now with JS. 
<script src = ....> </script>
does not even show up in WebInspector and thus my component fails miserably.

I think I am missing some basic (or might that be advanced?) understanding of html and the script and style elements.
This is the start of the html for the component that provides the content of the modal box

<webobject name = "updateContainer">

<script type = "text/javascript">
function just_a_dummy_function() {
alert('I am a dummy');
<script type = "text/javascript"
src = "<webobject name = datetimepicker_css_js />" >

<webobject name = "datetimepicker_js" />

<style type = "text/css">
<webobject name = "defaultStyles" />  

None of the script tags show up in the web inspector.
The first one is hardcoded but the string “dummy” does not show up.
The second one resolves the webobject element as WOResourceURL. I expect this to result in something like <script src=“...
The third one (dateimepicker_js) is an ERXJavaScript with a filename binding
The last one gets the css definitions via a WOString, so all the defs are hard coded.

The only one that works reliably is the last one. 

That’s so weird. Is there some magical incantation I need to utter next time full moon? Do I have to sacrifice my first born?

Please can anyone help me make some sense here?

On 14 Jul 2022, at 16:21, Markus Ruggiero (rucotec) <> wrote:

I have an AjaxModalDialog that uses a component to render its contents (which itself uses a WOSwitchComponent to change the contents inside the modal dialog). Some things inside this component need special CSS defs that are in a css file. Using ERXStyleSheet allows me to load the css via filename binding -> works! WebInspector shows a proper <link rel = ... in the html

When the user closes the dialog and reopens it the ERXStyleSheets do not render again -> no <link rel = .... in the html, styles are now missing and the dialog contents looks wrong. A hardcoded <style>...</style> definition is rendered in any case, just the ERXStyleSheets do not anymore. Reloading the whole page restores everything.


I have now (UGLY like hell!!) resorted to <style> <webobject name = “styles” /></style> and resolve the styles in code by reading the style file (WOResourceManager helping to find the file URL) and returning its contents as a String.

Any idea? This stuff drives me crazy....

Markus Ruggiero

rucotec GmbH                        web
Leonhardsberg 1                   email
4051 Basel / Switzerland         mobile +41 79 508 4701

Content Unaltered as verified By:
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster