Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Troubleshooting XForms Forms

Introduction

The idea of this page is to collect some solutions to some of the common errors typically made when creating an XForms form.

Always Do This First

  1. Make sure that you are running the latest release of the extension.
  2. Always run your form through the XForms validator. It checks your form for a lot of errors. It is not perfect, but it can spot a lot of errors.
  3. Always check the Javascript Console (Tools, Javascript Console) for errors. If you get errors there, do not expect your form to work.

Troubleshooting

Check The File Type

Is the page parsed as an XHTML document? Right-click on a blank spot on the page, and select View Page Info. The Type field should say application/xhtml+xml. Anything else, and something is wrong.

If your are loading your file directly from the filesystem, make sure that has .xhtml or .xml as the file ending. If you are loading the form from a server, make sure that it serves the files as either application/xhtml+xml or text/xml.

Check the XHTML 1.0 Namespace Declaration

Mozilla XForms is built upon the XHTML 1.0 specification, which is located at https://www.w3.org/1999/xhtml . Ensure that your <html> element contains the supported namespace declaration:

xmlns="https://www.w3.org/1999/xhtml"

(instead of the newer, unratified version, XHTML 2.0, located at https://www.w3.org/2002/06/xhtml2 )

Inline Instance, No Controls Get Bound

Have you remembered to use the correct namespace for the instance nodes? For an inline instance you most probably need to have <xf:instance xmlns=""> ....

Any Instance, No Controls Get Bound

If no controls show with either inline instance or an <xf:instance src="...">, check the following:

  • As with inline instance, make sure the instance of the form control ref binding expression matches the namespace of the data.
  • If form controls are within repeat, check that you are using attribute nodeset for the repeat instead of attribute ref.
  • If the instance is not in the empty namespace (xmlns=""), then all binding expressions must use a prefix bound to the namespace. XPath 1.0 expressions do not have a default namespace, so a prefix must always be specified if the namespace is not the empty namespace.
  • If your binding expression starts with a /, make sure the first thing is the name of the root node of the instance.
  • If your binding expression contains a /, look for any containing xf:group, xf:repeat, xf:input or other elements that set the context node.

instance(...) Not Working

Be aware that the instance(...) returns an element node, and not the document node. So with an instance like this:

  <xf:instance id="ins2" xmlns="">
    <data>
      <value>42</value>
    </data>
  </xf:instance>

You should use <output ref="instance('ins2')/value"/> to show the contents of the value element. (specification).

Repeat And Tables Not Working

Unfortunately you cannot do:

<table>
  <xf:repeat nodeset="...">
    <tr>
      ...
    </tr>
  </xf:repeat>
</table>

The XHTML modularization does not allow this. You either have to use CSS tables or repeat attributes, which at the moment are not working properly in the Firefox XForms extension :( Should be fixed by bug 306247 and bug 280368 respectively.

Submission Not Working

  • If you are trying to replace="instance" make sure that the document being returned is XML. There will be an error on the Javascript Console if it is not.
  • On most webservers you cannot use <submission method="post" action="file.xml"> to a static XML file. You need to use method="get", or <instance src="file.xml"> if the instance is always needed.
  • If you are trying to submit to a different domain than the form is loaded from, make sure that you have allowed cross-domain submission for that specific "form domain". Read here for more information.

Conflicts with other plug-ins

If you are using the NoScript plugin you may notice that your PUT and/or POST requests are being converted to GET requests. In order to fix this, go to the NoScript Options dialog (right-click on the 'S' icon on the status bar and select 'Options...') and select the Advanced tab. The XSS sub-tab has the following options:

  • Turn cross-site POST requests into data-less GET requests
  • Anti-XSS Protection Exceptions

You can temporarily fix the problem by unchecking the Turn cross-site POST requests into data-less GET requests check box.

Alternatively, for a long term fix you can enter an exception pattern in the Anti-XSS Protection Exceptions text area. If you are developing on your local machine using Apache Tomcat for example then add the following regular expression on a new line:

^https://localhost:8080/.*


Use the XForms Buddy to view instance data

The XForms Buddy extension allows you to dynamically view model instance data while the XForms is running in the FireFox browser. The home page for XFroms Buddy is located at:

XForms Buddy

Using HTTP Proxy

You can use the Charles FireFox extension to view your HTTP session data including HTTP header data.

If All Else Fails

Ask The Community

Ask on one of the mailing lists or on IRC. See the Community section on the XForms main page.

Check For Known Bugs / Missing Features

You can check the known bugs/missing features we have in the release notes of the extension.

You can also see the current list of open XForms bugs, or the list of fixed bugs that have not made it to the release versions yet.

Document Tags and Contributors

Tags: 
 Contributors to this page: Sheppy, Philip.fennell, Ankostis, Dmccreary, Beaworldchild, Beaufour, Klotz
 Last updated by: Sheppy,