Mailing List webobjects-dev@wocommunity.org Message #376
From: Markus Ruggiero (rucotec) <markus.ruggiero@rucotec.ch>
Subject: Re: [WO-DEV] ERXStyleSheet inside AjaxModalDialog
Date: Fri, 15 Jul 2022 15:48:39 +0200
To: WebObjects & WOnder Development <webobjects-dev@wocommunity.org>
Signed Data (Text SHA256)
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>
<script type = "text/javascript"
src = "<webobject name = datetimepicker_css_js />" >
</script>

<webobject name = "datetimepicker_js" />

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

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) <markus.ruggiero@rucotec.ch> 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.

Why?

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....







Content Unaltered as verified By:
<markus.ruggiero@rucotec.ch>
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster