当前位置: 首页 > 网络学院 > XML相关教程 > XForms > XForms 输入控件

XForms
XForms 介绍
XForms 模型
XForms 命名空间
XForms 实例
XForms XPath
XForms 输入控件
XForms 选择控件
XForms 数据类型
XForms 属性
XForms 行为(Actions)
XForms 函数
Xforms 数据类型参考

XForms 输入控件


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 649 ::
收藏到网摘: n/a

The user interface of XForms uses XForms controls.
XForms 的用户界面使用 XForms 控件。


XForms Controls
XForms控件

The user interface elements in XForms are called XForms Controls.
XForms 中的用户界面元素被称为 XForms 控件

The most commonly used control elements are <input> and <submit>.
最常用的控件元素是 <input> 和 <submit>。

Each control element has a ref attribute pointing back to the XForms data model.
每个控件元素均有 ref 属性指回 XForms 的数据模型。


Device Independent Controls
独立于设备的控件

It is important to know that the XForms user interface does not describe exactly how to display the XForms controls.
理解 XForms 用户界面并不会确切地描述如何显示 XForms 控件是很重要。

Because XForms is platform and device independent, XForms leaves it up to the browser to decide how to display the controls.
由于 XForms 是独立于平台和设备的,XForms 把如何显示这些空间的权利留给了浏览器。

This way XForms can be used for all types of devices, personal computers, cell phones, hand held computers and much more. XForms is also the perfect solution for defining user interfaces for people with disabilities (handicapped, blind).
正因如此,XForms 可被用于所有类型的设备,个人电脑,移动电话、手持计算机等等。XForms 同时也是为残障人士定义用户界面的完美解决方案。


The Input Control
Input 控件

The input control is the most common XForms control. It is used for input one line of text:
input 控件是最常用的 XForms 控件。它用于输入一行文本:

<input ref="name/fname">
<label>First Name</label>
</input>

Most often the input control will display as an input field like this:
大多数时候,input 控件会被显示为类似这样的输入域:

First Name:

Try it yourself
请自己试试


The <label> Element
<label>元素

The <label> element is a mandatory child element for all XForms input controls.
<label> 元素是所有 XForms 输入控件的强制子元素。

The reason for this is to secure that the form can be used for all types of devices (because labels can be treated in different ways). For voice software the label has to be spoken, and for some hand held computers the label has to follow the input, screen by screen.
这一点的原因是为了确保表单可用于所有类型的设备(因为标签可通过不同的方式来处理。)对于语音软件,标签可被读出,而对于某些手持设备,标签必须一屏接一屏的跟随输入。


The Secret Control
Secret 控件

The secret control is a special variant of the input control, designed to input passwords or other hidden information:
Secret 控件是 input 空间的特殊变体,被设计用于输入密码或其他隐藏的信息:

<secret ref="name/password">
<label>Password:</label>

</secret>

Most often the secret control will display as an input field like this:
大多数时候,secret 控件会显示为这样一个输入域:

Password:


The Textarea Control
Textarea 控件

The textarea control is used for multi-line input:
textarea 控件可显示为这样的输入域:

<textarea ref="message">
<label>Message</label>
</textarea>

The textarea control might display as an input field like this:
文本区域控制也许展示成像这样的输入区域:

Message:


The Submit Control
Submit 控件

The submit control is used for submitting the data:
Submit 控件用于提交数据:

<submit submission="form1">
<label>Submit</label>
</submit>

 


The Trigger Control
Trigger 控件

The trigger is used to trigger an action:
trigger 控件用于触发某个动作:

<trigger ref="calculate">
<label>Calculate!</label>
</trigger>

 


The Output Control
Output 控件

The output control is used to display XForms data:
output 空间用于显示 XForms 数据:

<p>First Name: <output ref="name/fname" /></p>

<p>Last Name: <output ref="name/lname" /></p>

The example above will simply output the content of the <fname> and <lname> node in the XForms XML document (XForms instance):
上面的例子仅仅可输出 XForms XML 文档(XForms 实例)中的 <fname> and <lname> 节点的内容:

<instance>
<person>
<name>
<fname>Hege</fname>
<lname>Refsnes</lname>

</name>
</person>
</instance>

And display it like this:
它会展示成这样:

First Name: Hege

Last Name: Refsnes

Try it yourself
自己试试


The Upload Control
Upload 控件

The upload control is designed for uploading files to a server:
upload 控件是为向服务器上传文件而设计的:

<upload bind="name">
<label>File to upload:</label>
<filename bind="file"/>

<mediatype bind="media"/>
</upload>

评论 (0) All

登陆 | 还没注册?