Cjax Framework



This sample makes use of different CJAX APIs to create a Overlay/validation functionality. The validation plugin makes use of Jquery.validate plugin.

Examples

PHP
<?php 

    
//5.0-RC3+
    //Total 3 lines of code!, (not including the customs rules)

    //Note: For sample#2 look inside the controller: examples/controllers/overlay_validation.php:overlay_validation::overlay2();

    #Sample #1
    //initial action to the 'launch' link
    
$rules = array(
        
'rules' => array(
            
'a[name]' => array(
                
'required' => true,
                
'minlength'  => 5,
                ),
                
'a[last_name]' => array(
                
'required' => true,
                
'minlength'  => 5,
                )
                ),
                
'messages' => array(
                
'a[name]' => array(
                
'required' => 'Please enter your name',
                ),
                
'a[last_name]' => array(
                
'required' => 'Enter your last name',
            )
        )
    );


    
$overlay $ajax->overLay('resources/html/test_form.html');
    
$overlay->validate('button1','ajax.php?overlay_validation/form'$rules);

    
$ajax->click('link'$overlay);

    
//Controller

    
class overlay_validation {

        function 
form()
        {
            
$ajax ajax();
            
//show posted variables
            
$ajax->debug($_POST,'Post Debug Info',"These are the fields posted.");
        }
    }
    
?>

Try it


Launch Sample #1

Launch Sample #2


Used in sample:

Previous Topic:  Previous Class    ·   Top of Page   ·   Demos Home   ·  

CodeIgniter  ·  Copyright © 2006 - 2012  ·  Cjax