<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.7.2" -->
<rss version="2.0">
    <channel>
        <title>validators[ Search for &quot;&quot;]</title>
        <description></description>
        <link>http://xataface.com/wiki/index.php?-action=single_record_search&amp;-table=wiki&amp;page_id=%3D95&amp;-cursor=0&amp;-skip=0&amp;-limit=30&amp;-mode=list&amp;--subsearch=</link>
        <lastBuildDate>Fri, 24 May 2013 04:29:10 +0100</lastBuildDate>
        <generator>FeedCreator 1.7.2</generator>
        <item>
            <title>validators</title>
            <link>http://www.xataface.com/wiki/validators</link>
            <description>&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;/th&gt;&lt;th&gt;Value&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Page name&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;validators&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Page id&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;95&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Page title&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;validators:NAME fields.ini directive&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Content&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;&lt;p&gt;Return to &lt;a href=&quot;/wiki/fields.ini_file&quot;&gt;fields.ini file&lt;/a&gt;&lt;/p&gt;

&lt;table border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;&lt;tr&gt;&lt;td&gt;
&lt;div id=&quot;toc&quot;&gt;&lt;strong&gt;Table of Contents&lt;/strong&gt;
	&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#toc0&quot;&gt;Synopsis&lt;/a&gt;&lt;/div&gt;
	&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#toc1&quot;&gt;Available Validators&lt;/a&gt;&lt;/div&gt;
	&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#toc2&quot;&gt;Examples&lt;/a&gt;&lt;/div&gt;
	&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#toc3&quot;&gt;See Also&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;


&lt;h3 id=&quot;toc0&quot;&gt;Synopsis&lt;/h3&gt;
&lt;p&gt;In the fields.ini file you can specify validation rules to be applied to any field by adding the validators:NAME directive in that field's section of the &lt;a href=&quot;/wiki/fields.ini_file&quot;&gt;fields.ini file&lt;/a&gt;.&lt;/p&gt;


&lt;h3 id=&quot;toc1&quot;&gt;Available Validators&lt;/h3&gt;


&lt;table class=&quot;listing listing2&quot;&gt;
    &lt;tr&gt;
        &lt;th&gt; Name&lt;/th&gt;
        &lt;th&gt; Description&lt;/th&gt;
        &lt;th&gt; Value&lt;/th&gt;
        &lt;th&gt; Version&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt; required&lt;/td&gt;
        &lt;td&gt; Field is required&lt;/td&gt;
        &lt;td&gt; 1&lt;/td&gt;
        &lt;td&gt; All&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt; maxlength&lt;/td&gt;
        &lt;td&gt; Maximum number of characters allowed.&lt;/td&gt;
        &lt;td&gt; $length&lt;/td&gt;
        &lt;td&gt; All&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt; minlength&lt;/td&gt;
        &lt;td&gt; Minimum number of characters allowed.&lt;/td&gt;
        &lt;td&gt; $length&lt;/td&gt;
        &lt;td&gt; All&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt; rangelength&lt;/td&gt;
        &lt;td&gt; Range (min and max) characters allows&lt;/td&gt;
        &lt;td&gt; $min,$max&lt;/td&gt;
        &lt;td&gt; All&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt; email&lt;/td&gt;
        &lt;td&gt; Input must be syntactically correct email address.&lt;/td&gt;
        &lt;td&gt; 1&lt;/td&gt;
        &lt;td&gt; All&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt; emailorblank&lt;/td&gt;
        &lt;td&gt; Accepts an email address or a blank field.&lt;/td&gt;
        &lt;td&gt; 1&lt;/td&gt;
        &lt;td&gt; All&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt; regex&lt;/td&gt;
        &lt;td&gt; Input must match the provided regular expression.&lt;/td&gt;
        &lt;td&gt; A regular expression&lt;/td&gt;
        &lt;td&gt; All&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt; lettersonly&lt;/td&gt;
        &lt;td&gt; Input must contain only letters (i.e. [a-zA-Z]&lt;/td&gt;
        &lt;td&gt; 1&lt;/td&gt;
        &lt;td&gt; All&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt; numeric&lt;/td&gt;
        &lt;td&gt; The input must contain a valid positive or negative integer or decimal number.&lt;/td&gt;
        &lt;td&gt; 1&lt;/td&gt;
        &lt;td&gt; All&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt; nopunctuation&lt;/td&gt;
        &lt;td&gt; The input must not contain any of these characters: ( ) . / * ^ ? # ! @ $ % + = , &quot; ' &amp;gt; &amp;lt; ~ [ ] { }.&lt;/td&gt;
        &lt;td&gt; 1&lt;/td&gt;
        &lt;td&gt; All&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt; nonzero&lt;/td&gt;
        &lt;td&gt; The input must not begin with zero.&lt;/td&gt;
        &lt;td&gt; 1&lt;/td&gt;
        &lt;td&gt; All&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt; uploadedfile&lt;/td&gt;
        &lt;td&gt; The element must contain a successfully uploaded file.&lt;/td&gt;
        &lt;td&gt; 1&lt;/td&gt;
        &lt;td&gt; All&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt; maxfilesize&lt;/td&gt;
        &lt;td&gt; The uploaded file must be no more than $size bytes.&lt;/td&gt;
        &lt;td&gt; $size&lt;/td&gt;
        &lt;td&gt; All&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;filename&lt;/td&gt;
        &lt;td&gt; The uploaded file must have a filename that matches the regular expression $file_rx.&lt;/td&gt;
        &lt;td&gt; $file_rx&lt;/td&gt;
        &lt;td&gt; All&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;


&lt;h3 id=&quot;toc2&quot;&gt;Examples&lt;/h3&gt;
&lt;p&gt;To make a the first_name field required we add the following to the &lt;a href=&quot;/wiki/fields.ini_file&quot;&gt;fields.ini file&lt;/a&gt;: 
&lt;pre&gt;&lt;code&gt;[first_name]
    validators:required=1&lt;/code&gt;&lt;/pre&gt;

&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note that fields that are declared NOT NULL in the database are required by default.&lt;/strong&gt;.  If you wanted to remove the &lt;em&gt;required&lt;/em&gt; validator from a field that is NOT NULL in the database you would add the following to the &lt;a href=&quot;/wiki/fields.ini_file&quot;&gt;fields.ini file&lt;/a&gt;: 
&lt;pre&gt;&lt;code&gt;[first_name]
    validators:required=0&lt;/code&gt;&lt;/pre&gt;

&lt;/p&gt;


&lt;h3 id=&quot;toc3&quot;&gt;See Also&lt;/h3&gt;
&lt;ul&gt;
    &lt;li&gt; &lt;a href=&quot;/wiki/fieldname__validate&quot;&gt;fieldname__validate&lt;/a&gt; - For more complex validation you can define the &lt;a href=&quot;/wiki/fieldname__validate&quot;&gt;fieldname__validate&lt;/a&gt; method in the &lt;a href=&quot;/wiki/Delegate_class_methods&quot;&gt;Table Delegate Class&lt;/a&gt;.&lt;/li&gt;
    &lt;li&gt; &lt;a href=&quot;http://www.devarticles.com/c/a/Web-Graphic-Design/Using-HTML-Quickform-for-Form-Processing/12/&quot; onclick=&quot;window.open(this.href, '_blank'); return false;&quot;&gt;HTML_QuickForm article&lt;/a&gt; going over HTML_Quickform validation.  Dataface's forms are built on HTML_QuickForm.&lt;/li&gt;
    &lt;li&gt; &lt;a href=&quot;http://xataface.com/documentation/tutorial/getting_started/validation&quot; onclick=&quot;window.open(this.href, '_blank'); return false;&quot;&gt;Form Validation&lt;/a&gt; - Section from getting started tutorial introducing form validation in a tutorial format.&lt;/li&gt;
&lt;/ul&gt;

&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Keywords&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;validation, form validation, validators,validator:name&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Language&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;en&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;</description>
            <author>validators</author>
        </item>
    </channel>
</rss>
