XForms - Noscript Mode Guide

Availability and status of this feature

This feature is deprecated as of Orbeon Forms 2016.3.

The "noscript" mode was designed for customer who had as a requirement that Orbeon Forms with browsers without JavaScript. However times have changed and the notion of accessibility is no longer tied to not using JavaScript. As of Orbeon Forms 4.x, we don't recommend to use this mode.

If you have any accessibility issues in the regular, JavaScript-enabled mode, please let us know.

This is an Orbeon Forms PE feature.

Introduction

The noscript mode is a special mode of the XForms engine which produces pure HTML pages without any JavaScript. This has the following benefits:
  • Compliance with laws or regulations in certain countries, which require that certain public sites do not use JavaScript or feature an option for JavaScript-free operation.
  • Make pages friendlier with screen readers, not all of which support properly very dynamic pages.
  • Allows targeting older browsers.
  • Allows targeting users who have decided not to enable JavaScript.
Because of the declarative aspects of XForms, a same page description written in XHTML and XForms can produce an Ajax output or a noscript output, thus saving on development time.

Limitations of the noscript mode

  • There is no "as you type" validation
  • User-triggered refreshes are needed to update field validity and other dynamic behavior (calculations)
  • There are no background file uploads
  • Some richer controls are not supported in noscript mode, because their implementation relies on script. This includes:
    • the rich text editor
    • dialogs
    • menu and tree select controls
  • Which mode is used, script-enabled or noscript, is determined before the page is sent to the browser (so not there is no "graceful degradation"). You'll find more details on this in the next section.

Enabling the noscript mode with Form Runner

Add xxf:noscript-support="true" to the main <xf:model> element of the form, via Form Builder's Edit Source.

The default for forms created with Form Builder is to have noscript support disabled.

When Forms have noscript enabled, using the fr-noscript=true URL parameter enables the noscript mode. There is also a navigation link to switch to and from the noscript mode in the page.

Enabling the noscript mode with plain XForms

You enable the noscript mode:
  • For a specific form
    • add xxf:noscript-support="true" to the main <xf:model> element of the form
    • add xxf:noscript="true" property to the main <xf:model> element of the form
The choice of whether users get the noscript or script-enabled version of your form is done ahead of time, before the HTML is sent to the browser.

NOTE: Orbeon Forms does not support sending a page to the browser which uses JavaScript if available but degrades to the noscript mode if JavaScript isn't available.

Typically, you'll want to present users for the script-enabled version of the form first, adding a link at the top that could read "Accessible version" and that points to the noscript version of the form. If you're using Form Builder / Form Runner, this will be done automatically for you.

The benefit of this approach is that you're giving users the choice of which version to use. In some cases, users might have a JavaScript enabled browser, but prefer the noscript version because it will work better with their screen reader. The drawback is that in the rare cases where users happen to use a browser that really doesn't support any JavaScript, they will have to do an additional click on "Accessible version" before they can get a version of the form they can use.

It is also possible to disable noscript support using the oxf.xforms.noscript-support property. See the Noscript mode properties.

Writing XForms supporting the noscript mode

Use property('xxf:noscript') in XPath: return true or false depending on whether you are in noscript mode or not.

Comments