Login   Register  
PHP Classes
elePHPant
Icontem

File: rules.inc.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Fransjo Leihitu  >  LiveValidationPHP  >  rules.inc.php  >  Download  
File: rules.inc.php
Role: Configuration script
Content type: text/plain
Description: Formvalidations rules
Class: LiveValidationPHP
Validate forms on the browser and server side
Author: By
Last change:
Date: 2007-09-21 01:10
Size: 8,249 bytes
 

Contents

Class file image Download
<?php
            $formRules 
=array();

            
$formRules["frmTest"]=array
            (
                
"element_1" => array
                (                    
                    
"args"=>array(),
                    
"display"=>"",
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),            
                    )    
                ),
                
                
"element_2" => array
                (                
                    
"args"=>array(),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),                
                        array
                        (
                            
"method"=>"Validate.Format",
                            
"args"=>array("pattern"=>"/live/i")
                        ),                    
                    )
                ),
                
"element_3" => array
                (                    
                    
"args"=>array(),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),                        
                
                        array
                        (
                            
"method"=>"Validate.Numericality",
                            
"args"=>array()
                        ),                
                    )
                ),
                
"element_4" => array
                (    
                    
"args"=>array(),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),                        
                                
                        array
                        (
                            
"method"=>"Validate.Numericality",
                            
"args"=>array("onlyInteger"=>true)
                        ),                
                    )
                ),                
                
"element_5" => array
                (
                    
"args"=>array(),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),                        
                                        
                        array
                        (
                            
"method"=>"Validate.Numericality",
                            
"args"=>array("is"=>2000)
                        ),                
                    )
                ),                
                
"element_6" => array
                (    
                    
"args"=>array(),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),                        
                                    
                        array
                        (
                            
"method"=>"Validate.Numericality",
                            
"args"=>array("minimum"=>2000)
                        ),                
                    )
                ),                    
                
"element_7" => array
                (
                    
"args"=>array(),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),                        
                
                        array
                        (
                            
"method"=>"Validate.Numericality",
                            
"args"=>array("maximum"=>2000)
                        ),                
                    )
                ),                
                
"element_8" => array
                (
                    
"args"=>array(),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),                        
                                        
                        array
                        (
                            
"method"=>"Validate.Numericality",
                            
"args"=>array("minimum"=>2000,"maximum"=>3000)
                        ),                
                    )
                ),                    
                
"element_9" => array
                (
                    
"args"=>array(),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),                        
                                        
                        array
                        (
                            
"method"=>"Validate.Numericality",
                            
"args"=>array("minimum"=>2000,"maximum"=>3000,"onlyInteger"=>true)
                        ),                
                    )
                ),                    
                
"element_10" => array
                (
                    
"args"=>array(),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),                        
                                        
                        array
                        (
                            
"method"=>"Validate.Length",
                            
"args"=>array("is"=>4)
                        ),                
                    )
                ),                    
                
"element_11" => array
                (
                    
"args"=>array(),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),                        
                                        
                        array
                        (
                            
"method"=>"Validate.Length",
                            
"args"=>array("minimum"=>4)
                        ),                
                    )
                ),                
                
"element_12" => array
                (
                    
"args"=>array(),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),                        
                                        
                        array
                        (
                            
"method"=>"Validate.Length",
                            
"args"=>array("maximum"=>4)
                        ),                
                    )
                ),                
                
"element_13" => array
                (
                    
"args"=>array(),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),                        
                                        
                        array
                        (
                            
"method"=>"Validate.Length",
                            
"args"=>array("maximum"=>4,"maximum"=>8)
                        ),                
                    )
                ),                
                
"element_14" => array
                (
                
                    
"args"=>array(),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),    
                                                                
                        array
                        (
                            
"method"=>"Validate.Inclusion",
                            
"args"=>array("within"=>array('cow' 'pigeon''giraffe'))
                        ),                
                    )
                ),                
                
"element_15" => array
                (
                    
"args"=>array(),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),                        
                                        
                        array
                        (
                            
"method"=>"Validate.Inclusion",
                            
"args"=>array("partialMatch"=>true,"within"=>array('cow' 'pigeon''giraffe'))
                        ),                
                    )
                ),
                
"element_16" => array
                (    
                    
"args"=>array(),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),                        
                                    
                        array
                        (
                            
"method"=>"Validate.Exclusion",
                            
"args"=>array("within"=>array('cow' 'pigeon''giraffe'))
                        ),                
                    )
                ),                
                
"element_17" => array
                (
                    
"args"=>array(),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),                        
                                        
                        array
                        (
                            
"method"=>"Validate.Exclusion",
                            
"args"=>array("partialMatch"=>true,"within"=>array('cow' 'pigeon''giraffe'))
                        ),                
                    )
                ),                
                
"element_18" => array
                (
                    
"args"=>array(),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),                        
                                        
                        array
                        (
                            
"method"=>"Validate.Acceptance",
                            
"args"=>array()
                        ),                
                    )
                ),
                
"element_19" => array
                (
                    
"args"=>array(),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),                        
                                        
                        array
                        (
                            
"method"=>"Validate.Confirmation",
                            
"args"=>array("match"=>"myPasswordField")
                        ),                
                    )
                ),                
                
"element_20" => array
                (
                    
"args"=>array(),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),                        
                                        
                        array
                        (
                            
"method"=>"Validate.Email",
                            
"args"=>array()
                        ),                
                    )
                ),
                
"element_21" => array
                (                    
                    
"args"=>array("onlyOnBlur"=>true),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),            
                    )    
                ),                            
                
"element_22" => array
                (                    
                    
"args"=>array("wait"=>300),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),            
                        array
                        (
                            
"method"=>"Validate.Length",
                            
"args"=>array("minimum"=>10)
                        ),                                    
                    )    
                ),                    
                
                
"element_23" => array
                (                    
                    
"args"=>array(),
                    
"rules"=>array
                    (
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),            
                        array
                        (
                            
"method"=>"Validate.Exclusion",
                            
"args"=>array("failureMessage"=>"Please select something!","within"=>array('Please select...'))
                        ),                                    
                    )    
                ),                
            );        

            
            
$formRules["frmTestLive"]=array(
                
"test_hello" => array
                (        
                    
"args"=>array("validMessage"=>"Ait you go girl!"),                    
                    
"rules"=>array
                    (                            
                        array
                        (
                            
"method"=>"Validate.Presence",
                            
"args"=>array()
                        ),
                        array
                        (
                            
"method"=>"Validate.Format",
                            
"args"=>array("pattern"=>"/^hello$/i","failureMessage"=>"Chicken!That was not a hello")
                        ),                    
                    )
                ),
            );
            
?>