Skip to content
Hub Nexus

No author yetClaim it

Version 1Updated 2 min read

Support

Motivation

You want to load a new resource over your current form.

Usage

In HTML links are simple. You use the HTML anchor tag

href="http://example.com">like label

However, in XForms, it is a bit more complex:

appearance="minimal">
Go to Google
ev:event="DOMActivate">
show="replace">
value="'http://www.google.com'"/>

The XForms xf:load element has several attributes.

  • ref - a static reference to a single node
  • resource - a static URL such as a relative or absolute URL
  • show - if a new page is created or the current page replaced. Show can have two values: new or replace.
  • target - the target action to be executed

One is the URI of the resource to load and the other is the show attribute. The show attribute can have values of "replace" which will replace the current form with the new resource and "new" which will open a new tab in your web browser or a new window if you are running older browsers such as IE 6.

resource="search.xq" show="new"/>
resource="search.xq" show="replace"/>

xf:load can also be used to run a local javascript function when a form loads:

ev:event="xforms-ready">
resource="javascript:init()"/>

Loading Dynamic Strings

Note that the ref attribute of xf:load can only be a static string. You can not change this as the XForms application changes.

If you need to load dynamic string the way to do this is to use the xf:resource element within the xf:load element. The xf:resource element has a value attribute that is used to hold all the dynamic expressions.

For example, the following example concats a URL and the search query from an input field.

show="replace">
value="concat(url, q)"/>

Load with resource attribute value templates

Some implementations allow you to dynamically create URLs based on data in our mode.

ev:event= "DOMActivate"
resource= "http://www.google.com/{concat(string(instance('instance')/a), '{', '{{', string(instance('instance')/b), '}', '}}')}/{{something}}/else">

Releated XForms Examples

XForms/Search Using Load - This example shows how to use a REST search service using the xf:load element
XForms/Output and Links This example presents the user with a list of links. The user select one from a list and that item is loaded

Where this page came from

This page was imported from Wikibooks. From “XForms” on Wikibooks, by its contributors, under CC BY-SA 4.0. Changed here: set as a page; navigation and edit links left out; each image under its own licence, credited in its caption.

Nobody has written it yet — it is the source material at a new address, which is why search engines are asked to skip it and why no one earns from it. It is up for grabs: take it on, and it is yours to rewrite and to earn from.

Get each new page of

XForms

Following means one email when a page is added, nothing when a page changes.

Following means one email when a page is added, nothing when a page changes.

Comments

Spinner Logo

Next in XForms

CC BY-SA 4.0
On many HTML forms you fill out the form and press a button at the bottom of the form called "Save" or "Submit". You pressed the button and hoped your data would get saved. This is the same concept. But in this case the submit command can be triggered in many ways other that just a button being pres
CC BY-SA 4.0
action=" method="post" id="submit" includenamespaceprefixes=""/> action=" method="post" includenamespaceprefixes="#default"/> ## Sample Form xmlns=" xmlns:ev=" xmlns:xsd=" xmlns:xf=" xmlns:task=" task:dummy="dummy"> Test of XForms Submission Namespace Inclusion type="text/css"> @namespace xf url(" b
CC BY-SA 4.0
xmlns=" xmlns:ev=" xmlns:xhtml=" xmlns:xs=" xmlns:fr=" xmlns:xxforms=" xmlns:xf=" Save Test xmlns="" id="save-data"> form-id="unit-tests-save-test"> Dan McCreary xmlns="" id="save-results"> No Save Results Yet id="save-submission" ref="instance('save-data')" method="post" resource=" replace="instanc
CC BY-SA 4.0
Add the following instance to your model: xmlns="" id="log"> log initialized Whenever you want to see an event, just add an action that appends an event to the end of the log: ev:event="xforms-deselect"> nodeset="instance('log')/event" at="last()" position="after" /> ref="instance('log')/event[last(
CC BY-SA 4.0
First you need to give the control you want to receive the first keystroke event an **id** attribute. For example: id="first-field"> Search The next step is to use the **xforms-ready** event to set the focus to this field using the **setfocus** element. These initial actions are usually placed at th
CC BY-SA 4.0
id="tab-bar"> appearance="minimal"> Tab One case="case-1" ev:event="DOMActivate" /> appearance="minimal"> Tab Two case="case-2" ev:event="DOMActivate" /> appearance="minimal"> Tab Three case="case-3" ev:event="DOMActivate" /> id="case-1"> ev:event="xforms-select"> nodeset="instance('log')/event" at=