Attribute in custom control

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

Attribute in custom control

rovsh
Hi,

I created a custom control, and would like to send a value into it using attribute. The data type of the attribute is a URL which later will be used in <xforms:submission> to load the data inside XBL. I access the value of attribute inside custom control's XBL as follows:
<xf:var name="fetchurl" xbl:attr="xbl:text=fetch-url"/>

In <xforms:submission> I access the 'fetchurl' as follows:
<xforms:submission id="get-items" method="get" resource="$resource" replace="instance" instance="my-instance" serialization="none" />

However, this usage throws exception. What is the correct way to access attributes and use them in 'submission'?

Thanks.

-Rovsh
Reply | Threaded
Open this post in threaded view
|

Re: Attribute in custom control

Erik Bruchez
Administrator
Is your model under <xbl:implementation> or <xbl:template>?

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: Attribute in custom control

rovsh
Hi Erik,
My model is under <xbl:template>.
Can you also please tell me what is the difference in declaring the model under <xbl:implementation> or <xbl:template>?

-Rovsh


Erik Bruchez wrote
Is your model under <xbl:implementation> or <xbl:template>?

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: Attribute in custom control

Erik Bruchez
Administrator
If under <xbl:implementation>, there is no template language (XSLT or XBL <content> or attr) applid.

If under <xbl:template>, the model, like the controls, goes through the template system. So you can customize it a bit more.

Unless needed, it's better if the model remains outside the template.

Here, with the model under xbl:template, you should be able to write:

<xforms:submission xbl:attr="resource=fetch-url" .../>

-Erik