Open main menu

Wikibooks β

XForms/Open Selection

< XForms



You want to have a control that suggests a set of values in a drop-down list but also allows a user to type in their own value.


Just add the attribute selection="open" to your select1 control:

<xf:select1 ref="my-data" selection="open">

Screen ImageEdit

Select1 Control with selection attribute set to be open

Note that although a list of possible countries is listed, the user can type in any country that is not on this list.

XForms ApplicationEdit

Load XForms Application

The following example allows you to select a country code or enter your own country code:

      <title>XForms Select1 Control Using Open Selection</title>
      <style type="text/css"><![CDATA[body {font-family: Helvetica, sans-serif;}]]></style>
            <xf:instance xmlns="">
      <p>XForms Select1 control using selection="open"</p>
      <xf:select1 ref="CountryCode" selection="open">
       Output: <xf:output ref="CountryCode"/>


Very often you want to suggest values to the user to ensure consistency of data entry. The problem is that there are sometimes exceptions to a small list of items and the open selection control allows these exceptions to be entered.

One challenge of using this control is to let the user know they can enter an exception. You may have to add instructional text on the form such as "type value in this field if it does not appear on this list".

Next Page: Select | Previous Page: Select1 drop list

Home: XForms