Creating Dynamic Links using XForms

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

Creating Dynamic Links using XForms

Kamlesh

Hi,
Following is my use case:

- A servlet is returning file names and corresponding URLs in form of XML.
- It is being displayed on the form using a repeater control.
- XForms trigger with minimal appearance and XForms load are used to display
the result in form of likns.

The problem is that the link is not dynamic. All the links are opening the URL
of the first link only.

How can I resolve this issue?

Following is the code snippet....
<fr:td>
<xforms:trigger submission="replace-form-with" appearance="minimal">
<xforms:label>
<xforms:output ref="name" />
</xforms:label>
<xforms:action ev:event="DOMActivate">
<xforms:setvalue ref="instance('URL-container')"
value="instance('searchResult')//file/url" />
<xforms:load ref="instance('searchResult')//file/url" />
</xforms:action>
</xforms:trigger>
</fr:td>

Used following example for reference:
http://en.wikibooks.org/wiki/XForms/Output_and_Links

Regards,
Kamlesh


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Creating Dynamic Links using XForms

Michael Moore-14
On Apr 16, 2009, at 6:31 AM, <[hidden email]> wrote:

> The problem is that the link is not dynamic. All the links are  
> opening the URL
> of the first link only.
> Following is the code snippet....
> ...
> <xforms:action ev:event="DOMActivate">
> <xforms:setvalue ref="instance('URL-container')"
> value="instance('searchResult')//file/url" />
> <xforms:load ref="instance('searchResult')//file/url" />
> </xforms:action>
> ...
> Used following example for reference:
> http://en.wikibooks.org/wiki/XForms/Output_and_Links
I am new here, so this is a stab. Please use the proper skepticism.

I think the 'value' of the shown 'setvalue' element needs to reference  
the specific repeated element within your search results using index()  
with the id of your repeat. Otherwise, the current  
instance('searchResult')//file/url will have the entire set of data be  
converted to a single node (the first item). Maybe try this for your  
'setvalue' element (inserting the id of your repeat element  
appropriately since I do not see your repeat in your code snippet:

xforms:setvalue ref="instance('URL-container')"
value="instance('searchResult')/file[index('IDOFYOURREPEAT')]/url" />

this seems to match the example you pointed to at http://en.wikibooks.org/wiki/XForms/Output_and_Links 
:

<xf:setvalue ref="instance('URL-container')" value="concat('http://en.wikipedia.org/wiki/' 
, instance('links')/link[index('link-repeat')]/wikipedia-id)" />

I am not sure about the need for the double-slash before 'file/url' in  
your snippet either. You might try that as either single or double to  
see what works.

Good Luck,

-Michael



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Creating Dynamic Links using XForms

Erik Bruchez
Administrator
In reply to this post by Kamlesh
Try an AVT:

<a href="{xpath/expression}">Go</a>

-Erik

On Apr 16, 2009, at 6:31 AM, <[hidden email]> <[hidden email]
 > wrote:

>
> Hi,
> Following is my use case:
>
> - A servlet is returning file names and corresponding URLs in form  
> of XML.
> - It is being displayed on the form using a repeater control.
> - XForms trigger with minimal appearance and XForms load are used to  
> display
> the result in form of likns.
>
> The problem is that the link is not dynamic. All the links are  
> opening the URL
> of the first link only.
>
> How can I resolve this issue?
>
> Following is the code snippet....
> <fr:td>
> <xforms:trigger submission="replace-form-with" appearance="minimal">
> <xforms:label>
> <xforms:output ref="name" />
> </xforms:label>
> <xforms:action ev:event="DOMActivate">
> <xforms:setvalue ref="instance('URL-container')"
> value="instance('searchResult')//file/url" />
> <xforms:load ref="instance('searchResult')//file/url" />
> </xforms:action>
> </xforms:trigger>
> </fr:td>
>
> Used following example for reference:
> http://en.wikibooks.org/wiki/XForms/Output_and_Links
>
> Regards,
> Kamlesh
>
> --
> You receive this message as a subscriber of the [hidden email]  
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws