















|
<PowerForms Syntax>
PowerForms extends standard html syntax with the following
xml syntax. As PowerForms uses xml syntax all attribute
values must be enclosed in single (') or double quotes
(").
Syntax
Semantics
Assigning formats to fields
-
<format [form=form] field=field>
Declares that fields named field must
satisfy the format. If no fields are named
field the declaration has no effect. The
optional attribute form is used to state to
which form the declaration applies.
If no form attribute is supplied and only a
single form is declared on the html page then the
format applies to field on the single form. If
more than one form is declared and the format
declaration occurs inside some form then the format
applies to field on the enclosing
form. Otherwise an error is reported.
If a field has a format that is the <empty/>-regexp, then that
field is valid no matter what the value is. See an
example of the use of <empty/>: personal.
Additional attributes
Three extra attributes are allowed in the format-tag:
-
help: a short help message to aid the user in
filling the field correct
-
warning: a short message to tell the user
that the field contains incomplete input
-
error: error message to show the user if he
tries to submit the form when the field contains
invalid data
Note: due to browser incompatibilities these
attributes are currently ignored until a submit error
occurs.
Formats
-
<format id=id>
Defines the format for future reference by the name id.
-
<format idref=id>
Evaluates to a previously declared format with name id.
-
<if>
If boolexp evaluates to true this
format evaluates to the format given inside
<then> . . . </then>.
Otherwise it evaluates to the format inside
<else> . . . </else>.
Boolean expressions
-
<match
[form=form]
field=field
>
Evaluates to true if and only if one value of
field on form matches the
regular expression (if field is a set of
checkboxes it can have more than one value). Otherwise
the result is false.
-
<matchall
[form=form]
field=field
>
Evaluates to true if and only if all values of
field on form matches the
regular expression. Otherwise the result is
false.
-
<equal
[form=form]
field=field
value=value
>
Evaluates to true if and only if one value of
field on form is equal to
value. Otherwise the result is
false.
-
<and>
Evaluates to true if and only if all the
boolean expressions in evaluates to
true. Otherwise the value is false.
-
<or>
Evaluates to true if and only if one of the
boolean expressions evaluates to
true. Otherwise the value is false.
-
<not>
Evaluates to true if and only if all the
boolean expressions evaluates to
false. Otherwise the value is false.
If the page contains only a single form, then the form
attribute is optional for both match and
equal.
Regular expressions
It is assumed that the reader is familiar with regular
expressions and below is a brief description of the
semantics of the PowerForms constructs for regular
expressions.
-
<empty>,
<anychar>, and
<anything>
Generates the languages consisting of respectively no
strings (not even the empty string), all strings of
length 1, and all strings.
-
<const
value=value
/>
Generates the language containing the string value.
-
<charset
value=value
/>
Generates the language containing all strings of
length 1 containing characters from
value.
-
<charrange
low=low
high=high
/>
Generates the language containing all strings of length 1
lexicographically between low and high, which both
must be of length 1.
-
<interval
low=low
high=high
/>
Generates the language consisting of integers between
low and high. If low
or high start with a leading 0 (ignoring
leading `-') both values must have the same number of
digits, and the language generated consists of
integers with leading 0's to make them the same length
as low and high (ignoring
leading `-').
-
<intersection>,
<concat>, and
<union>
Respectively, the intersection,
concatenation, and union of the
regexps.
-
<star>
<plus>
Respectively Zero or more, or one or more repetitions of the regexp.
-
<optional>
Zero or one occurence of the regexp.
-
<repeat
count=count
>
count consecutive occurences of the regexp.
-
<repeat
low=low
high=high
>
Between low and high
occurences of the regexp. At least one of
low or high must be
specified. If low is absent it defaults
to 0. If high is absent it defaults to
"infinity".
-
<complement>
The complement of the regexp.
-
<regexp
pattern=pattern
>
The regular expression encoded in
pattern. The syntax allowed in pattern
is a subset of that known from
perl
and flex.
See PowerForms regular
expression syntax for more specific information.
-
<regexp
id=id
>
Defines the regexp for future reference by the name id.
-
<regexp
idref=idref
>
Evaluates to a previously declared regexp with name id.
-
<regexp
url=url
>
Import of a regular expression from url.
See Format of
external regular expressions.
Submit
-
<submit
>
The submit element provides the same functionality as
an input element with type "submit", but with a more
flexible layout.
[DET ER FAND'ME EN DÅRLIG FORMULERING!!!]
The type attribute can have two values,
"button" and "anchor" (the default), which are
described below.
-
type="button": The submit
element is rendered as a button. The label on the
button is the plain text-value of the body if it
is non-empty. Otherwise the label is given by the
value attribute of the submit element.
-
type="anchor": The submit
element is rendered as an anchor containing the
body of the submit element.
As with submit-buttons only the name of the activated
submit element is sent to the server in the query
string. The submitted value is that of the
value attribute if it is present. Otherwise it
is the empty string.
Example: . . .
Other
bigwig@brics.dk
Last updated: October 10, 2001
|