ÍøÂçѧԺ w3popÉçÇø ÍøÂç×ÊÔ´ ITÐÂÎÅ

w3pop.com :: ÍøÂçѧԺ :: XForms :: XForms ÊäÈë¿Ø¼þ

»áÔ±µÇ½

ÕʺÅ

ÃÜÂë

»Ø´ð

¼ÇסÃÜÂë

Íü¼ÇÃÜÂë? ×¢²á

XForms
XForms ½éÉÜ
XForms Ä£ÐÍ
XForms ÃüÃû¿Õ¼ä
XForms ʵÀý
XForms XPath
XForms ÊäÈë¿Ø¼þ
XForms Ñ¡Ôñ¿Ø¼þ
XForms Êý¾ÝÀàÐÍ
XForms ÊôÐÔ
XForms ÐÐΪ£¨Act..
XForms º¯Êý
Xforms Êý¾ÝÀàÐͲ..

XForms ÊäÈë¿Ø¼þ


×÷Õß:w3pop.com ·­Òë/ÕûÀí:w3pop.com ·¢²¼:2007-04-29 ÐÞ¸Ä:2008-01-24 ä¯ÀÀ:1760 :: ::

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.
ÕâÒ»µãµÄÔ­ÒòÊÇΪÁËÈ·±£±íµ¥¿ÉÓÃÓÚËùÓÐÀàÐ͵ÄÉ豸£¨ÒòΪ±êÇ©¿Éͨ¹ý²»Í¬µÄ·½Ê½À´´¦Àí¡££©¶ÔÓÚÓïÒôÈí¼þ£¬±êÇ©¿É±»¶Á³ö£¬¶ø¶ÔÓÚijЩÊÖ³ÖÉ豸£¬±êÇ©±ØÐëÒ»ÆÁ½ÓÒ»ÆÁµÄ¸úËæÊäÈë¡£


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