XForms/Input

Basic Form Input
One of the most common user interface controls in a web form is a simple, one-line text area. In this example we have a very simple form with two input fields. Each input has its own label to the left of the input field.



Link to XForms Application
Input Fields

Program Structure
Our program has two parts, a model and a view. The model has instance data in it to store the values that the user enters in the form. The view is part of the presentation in the body of the HTML document.

Sample Program
  Enter your first name, and last name.  Input First-Name: Also known as given name.   Input Last Name: Also known as sur name or family name.  Output First Name:  Output Last Name:  Note that as you type the model output will be updated.

Hints
You can also provide the user with data entry hints using the <xf:hint> element.

Discussion
Notice that as you type, the output gets immediately updated. This is because the XForms input control has an  attribute.

Our model is simple, just the first and last name of a person.

Note that the   and   tags are nested INSIDE the input tags.