1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>1.5.2.1 FormField</title>
<META NAME="description" CONTENT="1.5.2.1 FormField">
<META NAME="keywords" CONTENT="lib">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="STYLESHEET" href="lib.css" type='text/css'>
<link rel="first" href="lib.html">
<link rel="contents" href="contents.html" title="Contents">
<LINK REL="next" HREF="node18.html">
<LINK REL="previous" HREF="node16.html">
<LINK REL="up" HREF="node16.html">
<LINK REL="next" HREF="node18.html">
<meta name='aesop' content='information'>
</head>
<body>
<DIV CLASS="navigation">
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A HREF="node16.html"><img src="../icons/previous.gif"
border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A HREF="node16.html"><img src="../icons/up.gif"
border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A HREF="node18.html"><img src="../icons/next.gif"
border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">CherryPy Standard Library Reference</td>
<td><A href="contents.html"><img src="../icons/contents.gif"
border="0" height="32"
alt="Contents" width="32"></A></td>
<td><img src="../icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
<td><img src="../icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" HREF="node16.html">1.5.2 Module</A>
<b class="navlabel">Up:</b> <a class="sectref" HREF="node16.html">1.5.2 Module</A>
<b class="navlabel">Next:</b> <a class="sectref" HREF="node18.html">1.5.2.2 FormSeparator</A>
<br><hr>
</DIV>
<!--End of Navigation Panel-->
<H3><A NAME="SECTION003521000000000000000">
1.5.2.1 FormField</A>
</H3>
A FormField instance is used for each of the form fields.
<P>
<dl><dt><b><a name="l2h-28"><tt class="function">function: __init__</tt></a></b>(<var>label, name, typ, mask=None, mandatory=0, size=15, optionList=[], defaultValue='', validate=None</var>)
<dd>
<P>
<var>label</var> is a string that will be displayed next to the field.
<P>
<var>name</var> is a string containing the name of the field.
<P>
<var>typ</var> is a string containing the type of the field. It can be one of the following:
text, password, file, hidden, submit, image, select, textarea, radio, checkbox
<P>
<var>mask</var> is a mask used to render the field. The default value is <var>defaultFormMask.defaultMask</var>. The mask will receive
the FormField instance as an argument and it should return some HTML to render the field.
<P>
<var>mandatory</var> is an integer that indicates whether the field is mandatory or not.
<P>
<var>size</var> is an integer that indicates the size of the field.
<P>
<var>mandatory</var> is an integer that indicates whether the field is mandatory or not (it is only used for some of the fields
like text or password).
<P>
<var>optionList</var> is a list of strings containing the different options for a fied (is is only used for
radio and checkbox fields).
<P>
<var>defaultValue</var> is a string containing the default value for the field.
<P>
<var>validate</var> is a function used to validate the field. The function will receive the value of the field as an argument,
and it should return <var>None</var> if the value is correct, or a string containing the error message if the value is not.
<P>
</dl>
<P>
<DIV CLASS="navigation">
<p><hr>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A HREF="node16.html"><img src="../icons/previous.gif"
border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A HREF="node16.html"><img src="../icons/up.gif"
border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A HREF="node18.html"><img src="../icons/next.gif"
border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">CherryPy Standard Library Reference</td>
<td><A href="contents.html"><img src="../icons/contents.gif"
border="0" height="32"
alt="Contents" width="32"></A></td>
<td><img src="../icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
<td><img src="../icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" HREF="node16.html">1.5.2 Module</A>
<b class="navlabel">Up:</b> <a class="sectref" HREF="node16.html">1.5.2 Module</A>
<b class="navlabel">Next:</b> <a class="sectref" HREF="node18.html">1.5.2.2 FormSeparator</A>
<hr>
<span class="release-info">Release 0.10, documentation updated on 19 March 2004.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>
|