w3pop.com :: ÍøÂçѧԺ :: XForms :: XForms ÊäÈë¿Ø¼þ
The user interface of XForms uses XForms controls.
XForms µÄÓû§½çÃæÊ¹Óà 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 µÄÊý¾ÝÄ£ÐÍ¡£
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 is the most common XForms control. It is used for input one line of text:
input ¿Ø¼þÊÇ×î³£ÓÃµÄ XForms ¿Ø¼þ¡£ËüÓÃÓÚÊäÈëÒ»ÐÐÎı¾£º
<input ref="name/fname"> |
Most often the input control will display as an input field like this:
´ó¶àÊýʱºò£¬input ¿Ø¼þ»á±»ÏÔʾΪÀàËÆÕâÑùµÄÊäÈëÓò£º
First Name:
Try it yourself
Çë×Ô¼ºÊÔÊÔ
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 is a special variant of the input control, designed to input passwords or other hidden information:
Secret ¿Ø¼þÊÇ input ¿Õ¼äµÄÌØÊâ±äÌ壬±»Éè¼ÆÓÃÓÚÊäÈëÃÜÂë»òÆäËûÒþ²ØµÄÐÅÏ¢£º
<secret ref="name/password"> |
Most often the secret control will display as an input field like this:
´ó¶àÊýʱºò£¬secret ¿Ø¼þ»áÏÔʾΪÕâÑùÒ»¸öÊäÈëÓò£º
Password:
The textarea control is used for multi-line input:
textarea ¿Ø¼þ¿ÉÏÔʾΪÕâÑùµÄÊäÈëÓò£º
<textarea ref="message"> |
The textarea control might display as an input field like this:
Îı¾ÇøÓò¿ØÖÆÒ²Ðíչʾ³ÉÏñÕâÑùµÄÊäÈëÇøÓò£º
Message:
The submit control is used for submitting the data:
Submit ¿Ø¼þÓÃÓÚÌá½»Êý¾Ý£º
<submit submission="form1"> |
The trigger is used to trigger an action:
trigger ¿Ø¼þÓÃÓÚ´¥·¢Ä³¸ö¶¯×÷£º
<trigger ref="calculate"> |
The output control is used to display XForms data:
output ¿Õ¼äÓÃÓÚÏÔʾ XForms Êý¾Ý£º
<p>First Name: <output ref="name/fname" /></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> |
And display it like this:
Ëü»áչʾ³ÉÕâÑù£º
|
First Name: Hege Last Name: Refsnes |
Try it yourself
×Ô¼ºÊÔÊÔ
The upload control is designed for uploading files to a server:
upload ¿Ø¼þÊÇΪÏò·þÎñÆ÷ÉÏ´«Îļþ¶øÉè¼ÆµÄ£º
<upload bind="name"> |
ÆÀÂÛ (0)
All