When creating a form for use in Webform Server, you cannot limit the amount
of text the user can enter by setting the size of the field.
In some cases, form designers may rely on the size of a field to limit
the amount of text the user can enter. For example, a multi-line field
with a
scrollhoriz of
wordwrap and a
scrollvert of
fixed normally prevents the user from typing beyond the visible
limit of the field.
However, Webform Server cannot restrict input in this manner. Instead,
the following rules apply:
- Single-Line Fields — You can
use the format option to limit the amount of text the user can type.
- Multi-Line Fields — There is
no way to limit the amount of text the user can type.
Example
The following field uses the length setting in the
format option
to limit text to 100 characters. Note that this assumes a single-line field.
<
field sid="Description"
<
value
<
/value
<
format
<
datatype
string<
/datatype
<
constraints
<
mandatory
optional<
/mandatory
<
length
<
min
0<
/min
<
max
100<
/max
<
/length
<
constraints
<
/format
<
/field
Exceptions to this practice
There are no exceptions to this practice.
Back to:
General
best practices