Hub Nexus
更新しました

著者著者はまだいません引き受ける

改善できるところがありますか?変更を提案しましょう。

支援

Motivation

Forms frequently need to display fields that are not editable by the user. The following program demonstrates this feature.

This is done in XForms using a binding and a style sheet.

A single field (or group of fields) can be marked as read-only with a single bind statement. For example, suppose you had a set of fields related to shipping supplies to remote staff in your IT department. The billing address could not be changed, only who an item was shipped to.

The following single line in the model would make all of the sub-elements of BillToAddress read-only:

nodeset="/PurchaseOrders/BillToAddress" readonly="true()" />

Note that because of CSS, all the fields under this binding will be marked read-only. This is one good reason you may want to logically group read-only data elements in an application.

Sample Program

XHTML XForm

xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms">;

Demonstration of Read-Only Binding
rel="stylesheet" type="text/css" href="table-form.css" />

xmlns="" src="PurchaseOrder.xml" />

nodeset="/PurchaseOrder/BillToAddress" readonly="true()" />

ref="/PurchaseOrder/BillToAddress">
class="box-label">Billing Address :
ref="OrganizationName">
Organization Name:

ref="LocationStreetFullText">
Street:

ref="LocationStreetFullText2">
/>

ref="LocationCityName">
City:

ref="LocationStateName">
State:

ref="LocationPostalID">
Postal Code:

ref="/PurchaseOrder/ShipToAddress">
class="box-label">Shipping Address :
ref="PersonName">
Person Name:

ref="LocationStreetFullText">
Street:

ref="LocationStreetFullText2">
/>

ref="LocationCityName">
City:

ref="LocationStateName">
State:

ref="LocationPostalID">
Postal Code:

Sample Instance Data (PurchaseOrder.xml)

xmlns="">

MegaCorp IT Dept.
123 Main St.
Mailstop 47
Anytown
Minnesota
55123

John Jones
123 Main Street SE
Apartment 123
Anytown
Minnesota
55123

XForms tabular layout stylesheet (table-form.css)

/* a stylesheet for tabular XForms input field alignment */

@namespace xf url("http://www.w3.org/2002/xforms");

/* give the input form labels and the fieldset legend a bold sans-serif font */
label {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: small;
}

xf|group {
border: black solid 2px;
padding: 5px;
width: 300px;
}

/* the labels are right-aligned in a 150px wide column */
xf|input xf|label {
width: 150px;
margin: 3px;
text-align: right;
}

/* the input values are left aligned */
xf|value {
text-align: left;
}

/* vertical area between input boxes */
input {
margin: .2em;
}

/* each input is a row in the group table */
xf|input {
display: table-row;
}

/* each label within an input is a cell in the input row */
xf|input xf|label {
display: table-cell;
}

/* each value (pseudo-element) is also a cell in the input row */
xf|input::value {
display: table-cell;
}

Where this page came from

This page was imported from Wikibooks. From “XForms” on Wikibooks, by its contributors, under CC BY-SA 4.0. Changed here: set as a page; navigation and edit links left out; each image under its own licence, credited in its caption.

Nobody has written it yet — it is the source material at a new address, which is why search engines are asked to skip it and why no one earns from it. It is up for grabs: take it on, and it is yours to rewrite and to earn from.

このページを含むマガジンXForms

言語English

ライセンス: CC BY-SA 4.0 · 出典 en.wikibooks.org

1

0

0

0

Spinner Logo

コメント

Spinner Logo
バージョン: 2CC0 1.0 — public domain
The runaway star that left the Tarantula Nebula
バージョン: 2CC0 1.0 — public domain
The Blackwell School, where segregation had no law behind it
バージョン: 2CC0 1.0 — public domain
The Eagle Nebula, seen in the infrared
バージョン: 2CC0 1.0 — public domain
The house where the Equal Rights Amendment was written
バージョン: 2CC0 1.0 — public domain
The Aleutians, the forgotten front of the Second World War
バージョン: 2CC0 1.0 — public domain
The Cosmic Cliffs are not cliffs