External CSS and JS files in custom XBL component

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

External CSS and JS files in custom XBL component

damiangury
This post was updated on .
Hi

I have my own XBL component and i would like to load external css file or js. For example:

<xbl:xbl xmlns:xf="http://www.w3.org/2002/xforms"
         xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
         xmlns:xi="http://www.w3.org/2001/XInclude"
         xmlns:xbl="http://www.w3.org/ns/xbl"
         xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
         xmlns:fr="http://orbeon.org/oxf/xml/form-runner">

    <xbl:script src="http://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.3.11/slick.js"/>
    <xbl:binding id="fr-custom-component" element="fr|custom-component" xxbl:mode="lhha binding value">
        <metadata xmlns="http://orbeon.org/oxf/xml/form-builder">
            <display-name lang="en">Custom Component</display-name>
            <templates>
            </templates>
        </metadata>
    </xbl:binding>
</xbl:xbl>

I add my xbl component to properties-form-builder.xml and I can use it in form builder but the specified script is not loaded. This same problem occurs with css external files.

When add the same file js / css to the component created by orbeon authors such currency.xbl file loads correctly.

 I'm using orbeon 4.7.0.201410231022 PE.

Where it can be a bug?

please help,
Damian
Reply | Threaded
Open this post in threaded view
|

Re: External CSS and JS files in custom XBL component

Alessandro  Vernet
Administrator
Hi Damian,

I am not seeing this here with 4.7. I tried adding <xbl:script src="http://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.3.11/slick.js"/> to a custom XBL component I have here, which I added to Form Builder, and if I have that line, right away when you load Form Builder (when the app/form name dialog shows), I can see that the JavaScript has been loaded by the browser:



Did I miss something about your scenario?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: External CSS and JS files in custom XBL component

damiangury
Hi,
Thanks for your fast answer. It's very weird...
I think that my example is complete but is my XBL component is correct? Maybe it is not complete. Can it lacks something?

Damian
Reply | Threaded
Open this post in threaded view
|

Re: External CSS and JS files in custom XBL component

damiangury
In reply to this post by Alessandro Vernet
Hi,
I still have the same problem.
Maybe my XBL component is incorrect? Do I forgot some detail?

Damian
Reply | Threaded
Open this post in threaded view
|

Re: External CSS and JS files in custom XBL component

Alessandro  Vernet
Administrator
Hi Damian,

Can you tell me exactly where you put the XBL file for that component? And which properties you added to properties-local.xml? (I am asking so I can try to reproduce this on a verbatim Orbeon Forms. And if you could, also try first, to make sure you can reproduce that issue on a verbatim build.)

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: External CSS and JS files in custom XBL component

damiangury
Hi,

My properties-local.xml looks like:

<properties xmlns:xs="http://www.w3.org/2001/XMLSchema"
            xmlns:oxf="http://www.orbeon.com/oxf/processors">
</properties>

So is empty. My js resource has external path: http://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.3.11/slick.js. Is it incorrect? I put my file in properties-form-builder.xml and see my component in form builder but I don't see js file.

Damian
Reply | Threaded
Open this post in threaded view
|

Re: External CSS and JS files in custom XBL component

Alessandro  Vernet
Administrator
Hi Damian,

I am trying to reproduce this, but I don't have enough of your files/setup to do so. The code you pasted there for your component is missing something since it doesn't have a <xbl:template>. Can you create a minimal version of your component and setup that reproduces your problem? (I'd recommend you try it on a verbatim install of Orbeon Forms, so you can be sure that your instructions are complete enough for one of us to reproduce the problem on our side without guesswork.)

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet