EzformsEzACL
Getting Started
Add Text Type Input
Add Check/Radio Input
Add Textarea
Add List
Validation
Error Reporting
Version Changes
Misc
     

Getting Started

Getting Started

This is still in BETA, no STABLE RELEASE
CAUTION: Use class at own risk! The author takes no responsibility for something going wrong for any reason.

First before anything, you will need to download the required files.

Versions: (Version Changes)

  • 0.6 BETA
  • 0.51 BETA
  • 0.5 BETA

Unzip the contents and
move Ezform.php into system/application/libraries/
move init_ezform.php into system/applications/init/

Lets add the library
<?php 
//This would be in a controller file
$this->load->library("ezform");
?>

Now, there is a problem with including the class this way. If you want more then 1 form on the same page, it's not going to happen because each form needs it's own class object. Form names also are created when initializing the object. So here is what I do to solve this problem. If you do it this way ignore the code above.

<?php 
    
require_once "system/libraries/Ezform.php";
    
$obj =& get_instance();
    
$obj->ezform_user = new Ezform("create_user"); // "create_user" will be the forms name/id
    
$obj->ci_is_loaded[] = "ezform_user";
    
//Now say you also want a login form on this page too
    
$obj->ezform_login = new Ezform("login");
    
$obj->ci_is_loaded[] = "ezform_login";
?>
Getting right to the view
<html>
<head>
<title>My Page</title>
<!--
    This is required if you plan to use any javascript validation
    Even if you do not plan to, put this in so when you do decide to use it, 
    it is all set up for you. This outputs nothing if you did not enable javascript 
    validation in your form.
-->
<?php echo $this->ezform->form_output_javascript(); ?>
</head>
<body>
<?php 
// Note: The first argument is for personal reference of the form name, the actual form name
//       is set when the class object is created
echo $this->ezform->form_open("myformsname",array("class"=>"form_open")); 
?>
--ALL THE FORM JUNK--
--ALL THE FORM JUNK--
--ALL THE FORM JUNK--
--ALL THE FORM JUNK--
--ALL THE FORM JUNK--
Now you can close a form in two ways. With the tradtional
</form>
Or having it match the form open tag by calling
<?php echo $this->ezform->form_close(); // Exact same output as "</form>" ?>
</body>
</html>

That is pretty much it for getting the bare bones form skeleton up.

Create two files in CI
ezform_user.php in system/application/controllers/ezform_user.php
and
ezform_user_add.php in system/application/views/ezform_user_add.php

You can copy and paste the contents from these files:
ezform_user.php.txt
ezform_user_add.php.txt

After you get those copied over go to www.yoursite.com/index.php?/ezform_user/add/
and start playing with it.

Online demo of some of the validation options. Click HERE.

Top