08.10.2017 Views

codeigniter_tutorial

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CodeIgniter<br />

In the above example, we have used the required rule setting. There are many rules<br />

available in the CodeIgniter, which are described below.<br />

Validation Rule Reference<br />

The following is a list of all the native rules that are available to use:<br />

Rule Parameter Description Example<br />

required<br />

matches<br />

regex_match<br />

differs<br />

is_unique<br />

min_length<br />

max_length<br />

exact_length<br />

greater_than<br />

greater_than_equal_to<br />

No<br />

Yes<br />

Yes<br />

Yes<br />

Yes<br />

Yes<br />

Yes<br />

Yes<br />

Yes<br />

Yes<br />

Returns FALSE if the<br />

form element is<br />

empty.<br />

Returns FALSE if the<br />

form element does<br />

not match the one in<br />

the parameter.<br />

Returns FALSE if the<br />

form element does<br />

not match the regular<br />

expression.<br />

Returns FALSE if the<br />

form element does<br />

not differ from the<br />

one in the parameter.<br />

Returns FALSE if the<br />

form element is not<br />

unique to the table<br />

and field name in the<br />

parameter. Note:<br />

This rule requires<br />

Query Builder to be<br />

enabled in order to<br />

work.<br />

Returns FALSE if the<br />

form element is<br />

shorter than the<br />

parameter value.<br />

Returns FALSE if the<br />

form element is<br />

longer than the<br />

parameter value.<br />

Returns FALSE if the<br />

form element is not<br />

exactly the<br />

parameter value.<br />

Returns FALSE if the<br />

form element is less<br />

than or equal to the<br />

parameter value or<br />

not numeric.<br />

Returns FALSE if the<br />

form element is less<br />

than the parameter<br />

value, or not<br />

numeric.<br />

matches[form_item]<br />

regex_match[/regex/]<br />

differs[form_item]<br />

is_unique[table.field]<br />

min_length[3]<br />

max_length[12]<br />

exact_length[8]<br />

greater_than[8]<br />

greater_than_equal_to[8]<br />

52

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!