On 11/1/2012 3:46, Jack Hodges wrote:
The SWP user guide says that the content in ui:headIncludes is copied into the <head> portion of the html when it is constructed. If I refer to one of the spin constraint variables (e.g. ?resource) in the javascript, will it be resolved properly in the page? --

Hi Jack,

ui:headIncludes cannot access variables from the element instance, so even if your SWP element takes arguments they will be unbound in the ui:headIncludes. This is because the headIncludes are only inserted once for a page, and many components in the same class hierarchy may share the same headIncludes by inheritance.

Also note that in order to use SPARQL variables in JavaScript, they are (of course) not evaluated client-side, but server side. So a typical scenario is to have something like

<script>
    function myFunction(resource) {
        doSomething(resource);
    }
</script>

in your ui:headIncludes and then use

<script>myFunction('{= ?resource }')</script>

in the ui:prototype to call the static JavaScript code from the head. This will hopefully address your scenario. If not please provide details.

HTH
Holger


-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary Network (EVN), TopBraid Composer, TopBraid Live,
TopBraid Ensemble, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
topbraid-users@googlegroups.com
To unsubscribe from this group, send email to
topbraid-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en



--
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary 
Network (EVN), TopBraid Composer, TopBraid Live,
TopBraid Ensemble, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
topbraid-users@googlegroups.com
To unsubscribe from this group, send email to
topbraid-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en


Reply via email to