CodeIgniter Forums

Full Version: FormIgniter.org launched - Easy form generator - source code now available
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6

El Forum

[eluser]Ollie Rattue[/eluser]
[quote author="mddd" date="1276094137"]Ollie, good idea and nice execution! As everybody is on the track of doing feature requests, I have one too Smile

Based on speed of use, I would suggest making the database definition part of the tool optional. Often (at
least in my workflow), the database is already be laid out. By skipping the 'database schema' part, making a
form would be even quicker![/quote]

Hey mddd, many thanks.

Could you give some more details on this? Do you mean being able to feed FormIgniter a schema and for it to output the form?

El Forum

[eluser]mddd[/eluser]
That is something I had not even thought about.. it could be cool: select a table from the database and FormIgniter could pre-populate the boxes with its information.

But what I meant was just, that I usually have my database already done before I start building forms. So I don't need the SQL part of FormIgniter. It would be nice if I could just leave the 'db field type' and 'field length/enum values' part empty.

El Forum

[eluser]mdhb2[/eluser]
awesome app, this make my work easier
thx in million man

El Forum

[eluser]timtocci[/eluser]
I'm trying to install FormIgniter in a subdirectory of my doc root in XAMPP(lite) on my Windows 7 box. I followed your install directions and I'm getting a whole bunch of errors:

Deprecated: Assigning the return value of new by reference is deprecated in C:\xampplite\htdocs\formigniter\system\codeigniter\Common.php on line 130

Deprecated: Assigning the return value of new by reference is deprecated in C:\xampplite\htdocs\formigniter\system\codeigniter\Common.php on line 136
A PHP Error was encountered

Severity: 8192

Message: Function set_magic_quotes_runtime() is deprecated

Filename: codeigniter/CodeIgniter.php

Line Number: 60

A PHP Error was encountered

Severity: 8192

Message: Assigning the return value of new by reference is deprecated

Filename: libraries/Loader.php

Line Number: 255

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\xampplite\htdocs\formigniter\system\codeigniter\Common.php:130)

Filename: libraries/Session.php

Line Number: 662

Do you have any tips for me or am I doing anything wrong?
Thanks

El Forum

[eluser]Ollie Rattue[/eluser]
Hey timtocci,

These look like PHP 5.3 related bugs. I recently upgraded the code to work on 1.7.2 with PHP 5.3 fixes.

You will find the source code at https://github.com/ollierattue/FormIgniter

Let me know if you still have issues,

Thanks,

El Forum

[eluser]gh0st[/eluser]
Is it possible to combine FormIgniter with say Doctrine or another ORM layer so that it generates admin-like form interfaces for you; perhaps using a YAML file as an interface?

El Forum

[eluser]Ollie Rattue[/eluser]
[quote author="gh0st" date="1297870537"]Is it possible to combine FormIgniter with say Doctrine or another ORM layer so that it generates admin-like form interfaces for you; perhaps using a YAML file as an interface?[/quote]

FormIgniter was built to automate the repetitive process of building a validated form in CodeIgniter. It has one purpose and does it well. I have always been reluctant to add features because it will actually make it less useful across the entire user base.

However the source code is available, so you can always modify it to suit your needs. Let me know if you do anything interesting with it,

Thanks,

El Forum

[eluser]eliminator2009[/eluser]
I have Just visited your site i have created a form at your site.

Now as per Readme.txt instruction i have placed the files at the relevant directories.

I am now getting this error.

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: data

Filename: controllers/myform.php

Line Number: 26

The generated codes are as below

Controller: myform.php

Code:
<?php

class Myform extends CI_Controller {
              
    function Myform()
    {
         parent::__construct();
        $this->load->library('form_validation');
        $this->load->database();
        $this->load->helper('form');
        $this->load->helper('url');
        $this->load->model('myform_model');
    }    
    function index()
    {            
        $this->form_validation->set_rules('date','Date','');            
        $this->form_validation->set_rules('smp_bm','SMP BM','');            
        $this->form_validation->set_rules('smp_cm','SMP CM','');            
        $this->form_validation->set_rules('butter_bm','Butter BM','');            
        $this->form_validation->set_rules('buttter_cm','Buttter CM','');
            
        $this->form_validation->set_error_delimiters('<br /><span class="error">', '</span>');
    
        if ($this->form_validation->run() == FALSE) // validation hasn'\t been passed
        {
            $this->load->view('myform_view', $data);
        }
        else // passed validation proceed to post success logic
        {
             // build array for the model
            
            $form_data = array(
                               'date' => set_value('date'),
                               'smp_bm' => set_value('smp_bm'),
                               'smp_cm' => set_value('smp_cm'),
                               'butter_bm' => set_value('butter_bm'),
                               'buttter_cm' => set_value('buttter_cm')
                        );
                    
            // run insert model to write data to db
        
            if ($this->myform_model->SaveForm($form_data) == TRUE) // the information has therefore been successfully saved in the db
            {
                redirect('myform/success');   // or whatever logic needs to occur
            }
            else
            {
            echo 'An error occurred saving your information. Please try again later';
            // Or whatever error handling is necessary
            }
        }
    }
    function success()
    {
            echo 'this form has been successfully submitted with all validation being passed. All messages or logic here. Please note
            sessions have not been used and would need to be added in to suit your app';
    }
}
?&gt;

Model-myform_model.php
Code:
&lt;?php

class Myform_model extends CI_Model {

    function __construct()
    {
        parent::__construct();
    }
    
    // --------------------------------------------------------------------

      /**
       * function SaveForm()
       *
       * insert form data
       * @param $form_data - array
       * @return Bool - TRUE or FALSE
       */

    function SaveForm($form_data)
    {
        $this->db->insert('myform', $form_data);
        
        if ($this->db->affected_rows() == '1')
        {
            return TRUE;
        }
        
        return FALSE;
    }
}
?&gt;

view-myform_view.php
Code:
&lt;?php // Change the css classes to suit your needs    

$attributes = array('class' => '', 'id' => '');
echo form_open('my_form', $attributes); ?&gt;

<p>
        <label for="date">Date</label>
        &lt;?php echo form_error('date'); ?&gt;
        <br />&lt;input id="date" type="text" name="date"  value="&lt;?php echo set_value('date'); ?&gt;"  /&gt;
</p>

<p>
        <label for="smp_bm">SMP BM</label>
        &lt;?php echo form_error('smp_bm'); ?&gt;
        <br />&lt;input id="smp_bm" type="text" name="smp_bm"  value="&lt;?php echo set_value('smp_bm'); ?&gt;"  /&gt;
</p>

<p>
        <label for="smp_cm">SMP CM</label>
        &lt;?php echo form_error('smp_cm'); ?&gt;
        <br />&lt;input id="smp_cm" type="text" name="smp_cm"  value="&lt;?php echo set_value('smp_cm'); ?&gt;"  /&gt;
</p>

<p>
        <label for="butter_bm">Butter BM</label>
        &lt;?php echo form_error('butter_bm'); ?&gt;
        <br />&lt;input id="butter_bm" type="text" name="butter_bm"  value="&lt;?php echo set_value('butter_bm'); ?&gt;"  /&gt;
</p>

<p>
        <label for="buttter_cm">Buttter CM</label>
        &lt;?php echo form_error('buttter_cm'); ?&gt;
        <br />&lt;input id="buttter_cm" type="text" name="buttter_cm"  value="&lt;?php echo set_value('buttter_cm'); ?&gt;"  /&gt;
</p>


<p>
        &lt;?php echo form_submit( 'submit', 'Submit'); ?&gt;
</p>

&lt;?php echo form_close(); ?&gt;

Thanks

El Forum

[eluser]JonoB[/eluser]
Exactly as the error message says: look on line 26 of your controller.

Code:
$this->load->view('myform_view', $data);

You are using a variable called $data, but you have not defined it yet.

El Forum

[eluser]eliminator2009[/eluser]
[quote author="JonoB" date="1305250007"]Exactly as the error message says: look on line 26 of your controller.

Code:
$this->load->view('myform_view', $data);

You are using a variable called $data, but you have not defined it yet.[/quote]

The all above files are auto generated by formigniter.

Where and how do i define $data variable in form.

Thanks.
Pages: 1 2 3 4 5 6