Mailing List webobjects-dev@wocommunity.org Message #379
From: Ramsey Gurley <Ramsey.Gurley@practicemojo.com>
Subject: Re: [WO-DEV] Re: ERXStyleSheet inside AjaxModalDialog
Date: Sun, 17 Jul 2022 23:38:03 +0000
To: WebObjects & WOnder Development <webobjects-dev@wocommunity.org>
It has been a while since I worked with AMD, but if I remember correctly, it doesn't properly load webserverresources dynamically. I had to preload everything in the page so that it was available when AMD needed it.



From: WebObjects & WOnder Development on behalf of Markus Ruggiero (rucotec)
Sent: Friday, July 15, 2022 6:48 AM
To: WebObjects & WOnder Development
Subject: [WO-DEV] Re: ERXStyleSheet inside AjaxModalDialog

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








Confidentiality Notice: This email, including all attachments and replies thereto, are covered by the Electronic Communications Privacy Act, 18 U.S.C. Sections 2510-2521 and are legally privileged. This information is confidential, and intended only for the use of the individuals or entities named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on the contents of this transmitted information is strictly prohibited. Please notify us if you have received this transmission in error. Thank you.
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster