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 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Wt: Wt::WLengthValidator Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespaceWt.html">Wt</a>::<a class="el" href="classWt_1_1WLengthValidator.html">WLengthValidator</a>
</div>
</div>
<div class="contents">
<h1>Wt::WLengthValidator Class Reference</h1><!-- doxytag: class="Wt::WLengthValidator" --><!-- doxytag: inherits="Wt::WValidator" -->A validator that checks the string length of user input.
<a href="#_details">More...</a>
<p>
<code>#include <Wt/WLengthValidator></code>
<p>
<div class="dynheader">
Inheritance diagram for Wt::WLengthValidator:</div>
<div class="dynsection">
<p><center><img src="classWt_1_1WLengthValidator__inherit__graph.png" border="0" usemap="#Wt_1_1WLengthValidator__inherit__map" alt="Inheritance graph"></center>
<map name="Wt_1_1WLengthValidator__inherit__map">
<area shape="rect" href="classWt_1_1WValidator.html" title="A validator is used to validate user input according to pre-defined rules." alt="" coords="25,80,132,107"><area shape="rect" href="classWt_1_1WObject.html" title="A base class for objects that participate in the signal/slot system." alt="" coords="31,5,127,32"></map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div>
<p>
<a href="classWt_1_1WLengthValidator-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d6ced22261c4dd0f249011a872c1ecbe"></a><!-- doxytag: member="Wt::WLengthValidator::WLengthValidator" ref="d6ced22261c4dd0f249011a872c1ecbe" args="(WObject *parent=0)" -->
</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WLengthValidator.html#d6ced22261c4dd0f249011a872c1ecbe">WLengthValidator</a> (<a class="el" href="classWt_1_1WObject.html">WObject</a> *parent=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates a length validator that accepts input of any length. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ee3614e5244c8bdbd226a781e014d82d"></a><!-- doxytag: member="Wt::WLengthValidator::WLengthValidator" ref="ee3614e5244c8bdbd226a781e014d82d" args="(int minLength, int maxLength, WObject *parent=0)" -->
</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WLengthValidator.html#ee3614e5244c8bdbd226a781e014d82d">WLengthValidator</a> (int minLength, int maxLength, <a class="el" href="classWt_1_1WObject.html">WObject</a> *parent=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates a length validator that accepts input within a length range. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WLengthValidator.html#6a772dfac01805c714374fd290ff6e6d">setMinimumLength</a> (int minimum)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Sets the minimum length. <a href="#6a772dfac01805c714374fd290ff6e6d"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WLengthValidator.html#68dede1a5faa6d83f9347d8dde68f6d1">minimumLength</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the minimum length. <a href="#68dede1a5faa6d83f9347d8dde68f6d1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WLengthValidator.html#1f1742e015228319a10dd42a38ef79f4">setMaximumLength</a> (int maximum)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Sets the maximum length. <a href="#1f1742e015228319a10dd42a38ef79f4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WLengthValidator.html#829f8c83606ed31a982e99fcd63b15fc">maximumLength</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the maximum length. <a href="#829f8c83606ed31a982e99fcd63b15fc"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="classWt_1_1WValidator.html#638a1feefca259ea2f806a8add2d18a3">State</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WLengthValidator.html#de2cb48af62ad35c7d7e50155fbf0e45">validate</a> (<a class="el" href="classWt_1_1WString.html">WString</a> &input) const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Validates the given input. <a href="#de2cb48af62ad35c7d7e50155fbf0e45"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="398750e14a071a4a7aff0d46d2266aaf"></a><!-- doxytag: member="Wt::WLengthValidator::createExtConfig" ref="398750e14a071a4a7aff0d46d2266aaf" args="(std::ostream &config) const " -->
virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WLengthValidator.html#398750e14a071a4a7aff0d46d2266aaf">createExtConfig</a> (std::ostream &config) const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Provides Ext-compatible config options for client-side validation. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WLengthValidator.html#61299b45c89e93a8d7aa7f2570242286">setInvalidTooShortText</a> (const <a class="el" href="classWt_1_1WString.html">WString</a> &text)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Sets the message to display when the input is too short. <a href="#61299b45c89e93a8d7aa7f2570242286"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classWt_1_1WString.html">WString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WLengthValidator.html#39f2dd4516c2b53c84343d5adfe2f384">invalidTooShortText</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the message displayed when the input is too short. <a href="#39f2dd4516c2b53c84343d5adfe2f384"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WLengthValidator.html#a24dd0a946f937e0dde081003bf30fec">setInvalidTooLongText</a> (const <a class="el" href="classWt_1_1WString.html">WString</a> &text)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Sets the message to display when the input is too long. <a href="#a24dd0a946f937e0dde081003bf30fec"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classWt_1_1WString.html">WString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WLengthValidator.html#5ba8fb18ad613678b7f744b05dda55cc">invalidTooLongText</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the message displayed when the input is too long. <a href="#5ba8fb18ad613678b7f744b05dda55cc"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WLengthValidator.html#2e8143bc9dedb9d4f7f77f3048bf5ff9">javaScriptValidate</a> (const std::string &jsRef) const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates a Javascript expression that validates the input. <a href="#2e8143bc9dedb9d4f7f77f3048bf5ff9"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A validator that checks the string length of user input.
<p>
This validator checks whether user input is within the specified range of accepted string lengths.<p>
If you only want to limit the length on a line edit, you may also use <a class="el" href="classWt_1_1WLineEdit.html#aeca334d8a47be029b6a44912b01ed5d" title="Specifies the maximum length of text that can be entered.">WLineEdit::setMaxLength()</a>.<p>
Usage example: <div class="fragment"><pre class="fragment"> <a class="code" href="classWt_1_1WLineEdit.html" title="A widget that provides a single line edit.">Wt::WLineEdit</a> *lineEdit = <span class="keyword">new</span> <a class="code" href="classWt_1_1WLineEdit.html" title="A widget that provides a single line edit.">Wt::WLineEdit</a>(<span class="keyword">this</span>);
<a class="code" href="classWt_1_1WLengthValidator.html" title="A validator that checks the string length of user input.">Wt::WLengthValidator</a> *validator = <span class="keyword">new</span> <a class="code" href="classWt_1_1WLengthValidator.html" title="A validator that checks the string length of user input.">Wt::WLengthValidator</a>(5, 15);
lineEdit-><a class="code" href="classWt_1_1WFormWidget.html#a773d16013d6959149ce5081e84b259c" title="Sets a validator for this field.">setValidator</a>(validator);
lineEdit-><a class="code" href="classWt_1_1WLineEdit.html#ddb99c6ab5483836adf44a2706a410af" title="Sets the content of the line edit.">setText</a>(<span class="stringliteral">"abcdef"</span>);
</pre></div> <hr><h2>Member Function Documentation</h2>
<a class="anchor" name="6a772dfac01805c714374fd290ff6e6d"></a><!-- doxytag: member="Wt::WLengthValidator::setMinimumLength" ref="6a772dfac01805c714374fd290ff6e6d" args="(int minimum)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WLengthValidator::setMinimumLength </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"> <em>minimum</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets the minimum length.
<p>
The default value is 0.
</div>
</div><p>
<a class="anchor" name="68dede1a5faa6d83f9347d8dde68f6d1"></a><!-- doxytag: member="Wt::WLengthValidator::minimumLength" ref="68dede1a5faa6d83f9347d8dde68f6d1" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int Wt::WLengthValidator::minimumLength </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the minimum length.
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WLengthValidator.html#6a772dfac01805c714374fd290ff6e6d" title="Sets the minimum length.">setMinimumLength(int)</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="1f1742e015228319a10dd42a38ef79f4"></a><!-- doxytag: member="Wt::WLengthValidator::setMaximumLength" ref="1f1742e015228319a10dd42a38ef79f4" args="(int maximum)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WLengthValidator::setMaximumLength </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"> <em>maximum</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets the maximum length.
<p>
The default value is the maximum integer value.
</div>
</div><p>
<a class="anchor" name="829f8c83606ed31a982e99fcd63b15fc"></a><!-- doxytag: member="Wt::WLengthValidator::maximumLength" ref="829f8c83606ed31a982e99fcd63b15fc" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int Wt::WLengthValidator::maximumLength </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the maximum length.
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WLengthValidator.html#1f1742e015228319a10dd42a38ef79f4" title="Sets the maximum length.">setMaximumLength(int)</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="de2cb48af62ad35c7d7e50155fbf0e45"></a><!-- doxytag: member="Wt::WLengthValidator::validate" ref="de2cb48af62ad35c7d7e50155fbf0e45" args="(WString &input) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classWt_1_1WValidator.html#638a1feefca259ea2f806a8add2d18a3">WValidator::State</a> Wt::WLengthValidator::validate </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classWt_1_1WString.html">WString</a> & </td>
<td class="paramname"> <em>input</em> </td>
<td> ) </td>
<td> const<code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Validates the given input.
<p>
The input is considered valid only when it is blank for a non-mandatory field, or has a length within the valid range.
<p>Reimplemented from <a class="el" href="classWt_1_1WValidator.html#fce53cf7c8fa1692234df0538163b4e0">Wt::WValidator</a>.</p>
</div>
</div><p>
<a class="anchor" name="61299b45c89e93a8d7aa7f2570242286"></a><!-- doxytag: member="Wt::WLengthValidator::setInvalidTooShortText" ref="61299b45c89e93a8d7aa7f2570242286" args="(const WString &text)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WLengthValidator::setInvalidTooShortText </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classWt_1_1WString.html">WString</a> & </td>
<td class="paramname"> <em>text</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets the message to display when the input is too short.
<p>
Depending on whether <a class="el" href="classWt_1_1WLengthValidator.html#829f8c83606ed31a982e99fcd63b15fc" title="Returns the maximum length.">maximumLength()</a> is a real bound, the default message is "The input must have a length between {1} and {2} characters" or " "The input must be at least {1} characters".
</div>
</div><p>
<a class="anchor" name="39f2dd4516c2b53c84343d5adfe2f384"></a><!-- doxytag: member="Wt::WLengthValidator::invalidTooShortText" ref="39f2dd4516c2b53c84343d5adfe2f384" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classWt_1_1WString.html">WString</a> Wt::WLengthValidator::invalidTooShortText </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the message displayed when the input is too short.
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WLengthValidator.html#61299b45c89e93a8d7aa7f2570242286" title="Sets the message to display when the input is too short.">setInvalidTooShortText(const WString&)</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="a24dd0a946f937e0dde081003bf30fec"></a><!-- doxytag: member="Wt::WLengthValidator::setInvalidTooLongText" ref="a24dd0a946f937e0dde081003bf30fec" args="(const WString &text)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WLengthValidator::setInvalidTooLongText </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classWt_1_1WString.html">WString</a> & </td>
<td class="paramname"> <em>text</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets the message to display when the input is too long.
<p>
Depending on whether <a class="el" href="classWt_1_1WLengthValidator.html#68dede1a5faa6d83f9347d8dde68f6d1" title="Returns the minimum length.">minimumLength()</a> is different from zero, the default message is "The input must have a length between {1} and {2} characters" or " "The input must be no more than {2} characters".
</div>
</div><p>
<a class="anchor" name="5ba8fb18ad613678b7f744b05dda55cc"></a><!-- doxytag: member="Wt::WLengthValidator::invalidTooLongText" ref="5ba8fb18ad613678b7f744b05dda55cc" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classWt_1_1WString.html">WString</a> Wt::WLengthValidator::invalidTooLongText </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the message displayed when the input is too long.
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WLengthValidator.html#a24dd0a946f937e0dde081003bf30fec" title="Sets the message to display when the input is too long.">setInvalidTooLongText(const WString&)</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="2e8143bc9dedb9d4f7f77f3048bf5ff9"></a><!-- doxytag: member="Wt::WLengthValidator::javaScriptValidate" ref="2e8143bc9dedb9d4f7f77f3048bf5ff9" args="(const std::string &jsRef) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">std::string Wt::WLengthValidator::javaScriptValidate </td>
<td>(</td>
<td class="paramtype">const std::string & </td>
<td class="paramname"> <em>jsRef</em> </td>
<td> ) </td>
<td> const<code> [protected, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates a Javascript expression that validates the input.
<p>
The JavaScript expression should evaluate to an object with two fields: a boolean <em>valid</em>, and a <code>message</code> that indicates the problem if not valid.<p>
Return an empty string if you are not provide the client-side validation.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WValidator.html#1ca29b7eaabf4c1655200ec382a84554" title="Returns a regular expression that filters input.">inputFilter()</a> </dd></dl>
<p>Reimplemented from <a class="el" href="classWt_1_1WValidator.html#5141a6c178329e6d26faad71e7bf26aa">Wt::WValidator</a>.</p>
</div>
</div><p>
</div>
<hr size="1"><address style="align: right;"><small>
Generated on Fri Mar 26 17:12:07 2010 for <a href="http://www.webtoolkit.eu/wt/">Wt</a> by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6</small></address>
</body>
</html>
|