4 <!-- Manpage converted by man2html 3.0.1 -->
8 <B>form_field_validation</B> - data type validation for fields
12 <H2>SYNOPSIS</H2><PRE>
13 <B>#include</B> <B><form.h></B>
14 int set_field_type(FIELD *field, FIELDTYPE *type, ...);
15 FIELDTYPE *field_type(const FIELD *field);
16 void *field_arg(const FIELD *field);
20 <H2>DESCRIPTION</H2><PRE>
21 The function <B>set_field_type</B> declares a data type for a
22 given form field. This is the type checked by validation
23 functions. The types are as follows:
26 Alphanumeric data. Requires a third <B>int</B> argument, a
30 Character data. Requires a third <B>int</B> argument, a
34 Accept one of a specified set of strings. Requires a
35 third <B>(char</B> <B>**)</B> argument pointing to a string list; a
36 fourth <B>int</B> flag argument to enable case-sensitivity;
37 and a fifth <B>int</B> flag argument specifying whether a
38 partial match must be a unique one (if this flag is
39 off, a prefix matches the first of any set of more
40 than one list elements with that prefix). Please
41 notice that the string list is not copied, only a
42 reference to it is stored in the field. So you should
43 avoid to use a list that lives in automatic variables
47 Integer data, parsable to an integer by <B>atoi(3)</B>.
48 Requires a third <B>int</B> argument controlling the preci-
49 sion, a fourth <B>long</B> argument constraining minimum
50 value, and a fifth <B>long</B> constraining maximum value.
51 If the maximum value is less or equal the minimum
52 value, the range is simply ignored. On return the
53 field buffer is formatted according to the <B>printf</B>
54 format specification ".*ld", where the '*' is
55 replaced by the precision argument. For details of
56 the precision handling see <B>printf's</B> man-page.
59 Numeric data (may have a decimal-point part).
60 Requires a third <B>int</B> argument controlling the preci-
61 sion, a fourth <B>double</B> argument constraining minimum
62 value, and a fifth <B>double</B> constraining maximum value.
63 If your system supports locale's, the decimal point
64 character to be used must be the one specified by
65 your locale. If the maximum value is less or equal
66 the minimum value, the range is simply ignored. On
67 return the field buffer is formatted according to the
68 <B>printf</B> format specification ".*f", where the '*' is
69 replaced by the precision argument. For details of
70 the precision handling see <B>printf's</B> man-page.
73 Regular expression data. Requires a regular expres-
74 sion <B>(char</B> <B>*)</B> third argument; the data is valid if
75 the regular expression matches it. Regular expres-
76 sions are in the format of <B><A HREF="regcomp.3x.html">regcomp(3x)</A></B> and
77 <B><A HREF="regexec.3x.html">regexec(3x)</A></B>. Please notice that the regular expres-
78 sion must match the whole field. If you have for
79 example an eight character wide field, a regular
80 expression "^[0-9]*$" always means that you have to
81 fill all eight positions with digits. If you want to
82 allow fewer digits, you may use for example "^[0-9]*
83 *$" which is good for trailing spaces (up to an empty
84 field), or "^ *[0-9]* *$" which is good for leading
85 and trailing spaces around the digits.
88 An Internet Protocol Version 4 address. This requires
89 no additional argument. It is checked whether or not
90 the buffer has the form a.b.c.d, where a,b,c and d
91 are numbers between 0 and 255. Trailing blanks in the
92 buffer are ignored. The address itself is not vali-
93 dated. Please note that this is an ncurses extension.
94 This field type may not be available in other curses
97 It is possible to set up new programmer-defined field
98 types. See the <B><A HREF="form_fieldtype.3x.html">form_fieldtype(3x)</A></B> manual page.
102 <H2>RETURN VALUE</H2><PRE>
103 The functions <B>field_type</B> and <B>field_arg</B> return <B>NULL</B> on
104 error. The function <B>set_field_type</B> returns one of the fol-
107 <B>E_OK</B> The routine succeeded.
109 <B>E_SYSTEM_ERROR</B>
110 System error occurred (see <B>errno</B>).
114 <H2>SEE ALSO</H2><PRE>
115 <B><A HREF="ncurses.3x.html">curses(3x)</A></B>, <B><A HREF="form.3x.html">form(3x)</A></B>.
120 The header file <B><form.h></B> automatically includes the header
121 file <B><curses.h></B>.
125 <H2>PORTABILITY</H2><PRE>
126 These routines emulate the System V forms library. They
127 were not supported on Version 7 or BSD versions.
131 <H2>AUTHORS</H2><PRE>
132 Juergen Pfeifer. Manual pages and adaptation for new
133 curses by Eric S. Raymond.
186 Man(1) output converted with
187 <a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>