ArticleslgStudy

science

XForms

XForms is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand XForms rather than just read about it. In short: XForms is an XML format used for collecting inputs from web forms. XForms was designed to be the next generation of HTML / XHTML forms, but is generic enough that it can also be used in a standalone manner or with presentation languages other than XHTML to describe a user interface and a set of common data manipulation tasks.

Key takeaways

  • XForms belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect XForms to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of XForms from memory before moving on to harder problems.

Reference excerpt

XForms is an XML format used for collecting inputs from web forms. XForms was designed to be the next generation of HTML / XHTML forms, but is generic enough that it can also be used in a standalone manner or with presentation languages other than XHTML to describe a user interface and a set of common data manipulation tasks. XForms 1.0 (Third Edition) was published on 29 October 2007. The original XForms specification became an official W3C Recommendation on 14 October 2003, while XForms 1.1, which introduced a number of improvements, reached the same status on 20 October 2009.

Differences from web forms In contrast to the original web forms (originally defined in HTML), the creators of XForms used a model–view–controller (MVC) approach. The model consists of one or more XForms models describing form data, constraints upon that data, and submissions. The view describes what controls appear in the form, how they are grouped together, and what data they are bound to. CSS can be used to describe a form's appearance. An XForms document can be as simple as a web form (by only specifying the submission element in the model section, and placing the controls in the body), but XForms includes many advanced features. For example, new data can be requested and used to update the form while it is running, much like using XMLHttpRequest/AJAX except without scripting. The form author can validate user data against XML Schema data types, require certain data, disable input controls or change sections of the form depending on circumstances, enforce particular relationships between data, input variable length arrays of data, output calculated values derived from form data, prefill entries using an XML document, respond to actions in real time (versus at submission time), and modify the style of each control depending on the device they are displayed on (desktop browser versus mobile versus text only, etc.). There is often no need for any scripting with languages such as JavaScript. However, XForms does include an event model and actions for implementing more complex form behaviors. Actions and event handling are specified using the XForms XML dialect rather than more common scripting languages like JavaScript. Like web forms, XForms can use various non-XML submission protocols (multipart/form-data, application/x-www-form-urlencoded), but a new feature is that XForms can send data to a server in XML format. XML documents can also be used to prefill data in the form. Because XML is a standard, many tools exist that can parse and modify data upon submission. Similar tools for legacy forms also exist. XForms is itself an XML dialect, and therefore can create and be created from other XML documents using XSLT. Using transformations, XForms can be automatically created from XML schemas, and XForms can be converted to XHTML forms.

Software support At the time of this writing, no widely used web browser supports XForms natively. However, various browser plugins, client-side extensions and server/client solutions exist. The following lists some implementations:

The Firefox XForms extension was part of the Mozilla Project. XForms 1.0 SE support is not complete but covers most of the specification with a notable exception of attribute-based repeating used in HTML tables. The extension was available for both Firefox 2 and Firefox 3, but is not upgraded to support Firefox 4 and higher. In July 2011 the lead developer wrote that XForms support would no longer get updated. Support for XForms was eventually deprecated in Firefox 19. IBM Lotus Forms supports development and deployment of XForms-based pure XML forms. Trial downloads are available of an Eclipse-based visual design environment and a client-side viewer that can run XForms-based forms both in the web browser and as a standalone desktop application. OpenOffice.org versions 2.0 and greater and LibreOffice support XForms.

Implementation technologies compared FormFaces, AJAXForms, XSLTForms, betterFORM, Chiba, Orbeon and Smartsite Forms are based on Ajax technology. The amount of server-side and client-side processing varies between these implementations. For example, Ubiquity XForms, FormFaces and XSLTForms provide 100% XForms client-side processing and data model updates via pure Ajax processing on the XForms standard. The others use server-side Java/.NET XForms processing transcoding to Ajax markup prior to delivering the content to the browser. Both techniques can work across browsers. Each implementation is significantly different with respect to dependencies, scalability, performance, licensing, maturity, network traffic, offline capability, and cross browser compatibility. System architects should evaluate these constraints against their needs to determine potential risks and objectives. Plugins like FormsPlayer and other client-side technology can have some benefits as well: because they integrate themselves into the browser, they will work with existing server architectures, can be more responsive, and require fewer server fetches. The tradeoff between server-side and client plug-in solutions is where the software is maintained; either each client must install the required plug-in, or the server architecture must change to accommodate the XForms transcoder engine language technology. It is in theory possible to mix both of these solutions, for instance testing the browser for a client-side XForms implementation and serving native XForms in that case, and defaulting to a server solution in other cases. Ubiquity XForms, FormFaces and XSLTForms provide a "zero software" solution on either the client or server: no new software needs to be installed on the client and the solution can be used in conjunction with any server-side architecture. This is possible because FormFaces and Ubiquity XForms are written 100% in Ajax and because XSLTForms is written in XSLT and in Ajax. The tradeoff is that compared to other solutions, more code is initially downloaded to the client (code can be cached on the client), and FormFaces does not yet support XML Schema validation. Furthermore, XForms submissions with replace "all" behaviour will typically not result in true page replacements and therefore break the normal back button behaviour.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with XForms

Start with the simplest possible case. Write down what XForms claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to XForms before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about XForms ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of XForms

In research
XForms appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses XForms in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
XForms is common in secondary-school and first-year university syllabi. It links to neighbouring topics User interface markup languages, World Wide Web Consortium standards, XML-based standards, so understanding it makes those chapters shorter.
In everyday life
Look for XForms outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “XForms” →

How to study XForms in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what XForms means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain XForms out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is XForms in simple terms?

XForms is an XML format used for collecting inputs from web forms. XForms was designed to be the next generation of HTML / XHTML forms, but is generic enough that it can also be used in a standalone manner or with presentation languages other than XHTML to describe a user interface and a set of com…

Why does XForms matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study XForms?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on XForms.

Tags

  • User interface markup languages
  • World Wide Web Consortium standards
  • XML-based standards

Keep exploring