AnsweredAssumed Answered

Form controls javascript and messages

Question asked by matthieulaborie on Jul 10, 2013
Latest reply on Jul 11, 2013 by matthieulaborie

We are developping a lot of form controls is there a way to include javascript and css only when the control are present in the form idem for i18n javascript keys ?

Today we are using 

            <css src="/modules/custom-autocomplete/autocomplete-ext.css" />
            <!– Spel editor –>
            <css src="/modules/spel-editor/spel-editor.css" />
            <css src="/modules/spel-editor/shThemeDefault.css" />
            <js src="/yui/editor/editor.js"/>
            <js src="/modules/spel-editor/spel-editor.js" />
            <js src="/modules/spel-editor/shCore.js" />
            <js src="/modules/spel-editor/shBrushJScript.js" />
            <!– Decision tree –>
            <css src="/components/form/controls/decision-tree.css" />
            <js src="/components/form/controls/decision-tree.js" />

Which is include in all forms. I have try using :

<@markup id="css" >
   <@link rel="stylesheet" type="text/css" href="${url.context}/res/modules/spel-editor/spel-editor.css" group="form" />
   <@link rel="stylesheet" type="text/css" href="${url.context}/res/modules/spel-editor/shThemeDefault.css" group="form" />

<@markup id="js">
   <@script type="text/javascript" src="${url.context}/res/yui/editor/editor.js" group="form" />
   <@script type="text/javascript" src="${url.context}/res/modules/spel-editor/spel-editor.js" group="form" />
   <@script type="text/javascript" src="${url.context}/res/modules/spel-editor/shCore.js" group="form" />
   <@script type="text/javascript" src="${url.context}/res/modules/spel-editor/shBrushJScript.js" group="form" />

in my controls

But it doesn't work when the form appear under popup mode throwing

TypeError: SpelEditor  is not a constructor

SpelEditor is define under spel-editor.js