WebWork 2:select Label

Source: Internet
Author: User

<ww:select/>
Generates a list of select options. The Quot;listkey property is the property used by each element in the list to generate <option> label value. The "ListValue" property fills the option's text label (display name). One major feature is that the appropriate options are automatically selected based on the "value" attribute. If value is equal to the current Listkey, the option is set to selected (if the type matches; see below).
<ww:select label= "' Users '"
Name= "' UserId '"
listkey= "id"
Listvalue= "Name"
List= "App.users"
Value= "App.user.id"
Onchange= "' Chooseuser (This) '"
/>

The following results are generated (assuming Getapp (). GetUser (). GetId () = 2):
<tr>
<td>Users</td>
<td>
<select name= "UserId" onchange= "Chooseuser (This)" >
<option value= "1" >
User Number One
</option>
<option value= "2" selected= "selected" >
User Number Two
</option>
</select>
<td>
</tr>
Of course, the <td> format depends on the template you use.

Usage examples
<ww:select label= "' Pets '"
Name= "' Petids '"
List= "Petdao.pets"
listkey= "id"
Listvalue= "Name"
Multiple= "true"
Size= "3"
Required= "true"
/>

<ww:select label= "' Months '"
Name= "' months '"
list= "#{': ' The", ' the ': ' Feb ', [...]} '
Value= "Selectedmonth"
Required= "true"
/>

The month ID (.) returned by the Getselectedmonth ()
Against the stack would be auto-selected
Note: For any label that uses the list data (select may be the most common), it uses the OGNL list notation (see the example above "months"), and note that the key values (in the months example, ' 01 ', ' 02 ', and so on) are manually entered. ' 1 ' is a character, ' 01 ' is a string, ' 1 ' is a string. If the values returned by the Value property are not the same as the key value types in the list, they cannot be matched even if the string values are the same. If it does not match, there are no automatically selected options in the list. Attribute names must be described
ID no HTML ID attribute
Name is the Name property of HTML
Value No field values
List no lists use an iterative data source, if the strong table is a map (key, value), the key will be the option value, value as its content (body)
Listkey the key Value property of the No List object
ListValue no List object's content properties
Headerkey whether the first option is built
Headervalue the value of the first option
Emptyoption whether to add a blank (--) option after the option header (header option)
Multiple do you want to allow multiple selections?
Size No HTML Size property
Disabled no HTML disabled properties
TabIndex No HTML TabIndex properties
OnChange No HTML onchange properties
OnClick No HTML onclick property
Label is used for tag text in templates
LabelPosition the alignment of the label (Left,right,center)
Required whether or not a required field is present on the form submission
CssClass No HTML class attribute
CSSStyle No HTML style property
Theme whether to use the theme
Template template name used

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.