EllisLab text mark
Advanced Search
2 of 4
2
   
FormIgniter.org launched - Easy form generator - source code now available
Posted: 26 October 2009 08:54 PM   [ Ignore ]   [ # 21 ]   [ Rating: 0 ]
Avatar
Joined: 2008-08-11
56 posts
drewbee - 13 May 2009 08:08 PM

One additional item that I noticed is that one of the rules can be auto set, as well as the part in the view.

When creating the field you have the option for max length. The rules for the field should automatically set max_length[10] and on the view, the maxlength of the attribute ie <input type=“text” maxlength=“10”>

Ollie Rattue - 13 May 2009 10:20 PM

drewbee, thanks for the insightful feedback. I really like the maxlength feature. As you say it is something thats suits FormIgniter. You enter the data quickly once and it reproduces it in numerous places; removing the repition is what it is all about. I will add this in when I get a moment, aswell as auto setting the ‘DB field Length/Values’ in the database Schema smile

Finally found some time to implement this feature. Thanks again for the great idea.

 Signature 

FormIgniter - Easy form generator for the CodeIgniter framework
Too many tabs - My weblog about web app development, startups, productivity and life design
Barometer - The easiest way to add a stylish feedback form to your website.
My Github code - Sage Pay, Autoresponder, EPDQ libraries
Follow me on Twitter

 
Posted: 26 October 2009 10:04 PM   [ Ignore ]   [ # 22 ]   [ Rating: 0 ]
Avatar
Joined: 2009-10-25
2 posts

Great work. This really rocks. Thanks for sharing.

 
Posted: 27 October 2009 02:43 AM   [ Ignore ]   [ # 23 ]   [ Rating: 0 ]
Joined: 2009-10-05
13 posts

There is a way to extend this to also serve as a one-stop database table editor, using a single view for the form. I’ve made tweaks to the standard ‘form’ generated like so:

In my model:

function SaveForm($form_data)
function 
UpdateForm($form_data$id)
function 
DeleteForm($id)
function 
GetForm($id)
function 
GetForms() 

In my View:

echo form_open('myform/add'$attributes); ?> 

Example form element ($var instead of set_value):

<p>
        <
label for="role_name">Role Name <span class="required">*</span></label>
        
<?php echo form_error('role_name'); ?>
        
<br /><input id="role_name" type="text" name="role_name" value="<?php echo $role_name; ?>"  />
</
p>

<
input type="hidden" name="id" value="<php echo $id; ?>" />
<
input type="hidden" name="operation" value="<?php echo $operation ?>" /> 

In my controller:

function index() - generalized for loop using a table generated via GetForms
    
function add() - handles UPDATES and INSERTS
        $this
->_validate(); // moved to separate function just to tidy the code up a bit
        
$validate_fields $this->form_validation->run();

        
$form_data = array(
            
'myform_name' => set_value('myform_name'),
            
'myform_level' => set_value('myform_level')
        );

        if (
$validate_fields == FALSE// validation hasn't been passed
        
{
            $form_data[
'role_id'set_value('role_id');
            
$form_data['operation'set_value('operation');
            
$data['content'$this->load->view('admin/roles_view'$form_datatrue);
        
}
        
else // passed validation proceed to post success logic
        
{
            
if (set_value('operation') == 'edit'{
                
// run update model to write data to db
                
if ($this->myform_model->UpdateForm($form_dataset_value('role_id')) == TRUE{
                    redirect
('myform');
                
else {
                    $data[
'content''An error occurred updating the data.';
                
}
            } 
else {
                
// run insert model to write data to db
                
if ($this-> myform_model->SaveForm($form_data) == TRUE{
                    redirect
('myform');
                
else {
                    $data[
'content''An error occurred adding the data.';
                
}
            }
        }
    
function edit($row_id{
        
if ($this->myform_model->GetForm($row_id) == TRUE{
            $data 
$this->myform_model->GetForm($row_id);
            
$data['operation''edit';
            
$data['content'$this->load->view('admin/roles_view'$datatrue);
        
else {
            $data[
'content''Could not find the requested record.';
        
}
        $this
->load->view('myform'$data);
    
}
    
function delete($row_id) - deletes a single record 

I could post my full code, but it is pretty basic stuff - the code above is chopped up to make it a bit more compact, and I got a little lazy in changing the names I used :D. The trouble occurs when you go to use the form helpers that set values - some require POST values, such that I had to rewrite the cb, rb, and select setters. There may be unintended consequences to this, but they seem to work.

 
Posted: 27 October 2009 09:26 AM   [ Ignore ]   [ # 24 ]   [ Rating: 0 ]
Avatar
Joined: 2008-08-11
56 posts
ururk - 27 October 2009 06:43 AM

I could post my full code, but it is pretty basic stuff - the code above is chopped up to make it a bit more compact, and I got a little lazy in changing the names I used :D. The trouble occurs when you go to use the form helpers that set values - some require POST values, such that I had to rewrite the cb, rb, and select setters. There may be unintended consequences to this, but they seem to work.

Yes a code upload would be great!

CRUD is one of the two things I have been thinking about recently, the other being jQuery validation.

 Signature 

FormIgniter - Easy form generator for the CodeIgniter framework
Too many tabs - My weblog about web app development, startups, productivity and life design
Barometer - The easiest way to add a stylish feedback form to your website.
My Github code - Sage Pay, Autoresponder, EPDQ libraries
Follow me on Twitter

 
Posted: 27 October 2009 09:41 AM   [ Ignore ]   [ # 25 ]   [ Rating: 0 ]
Joined: 2009-10-05
13 posts

Will do… as soon as I get this project completed… or maybe sooner.

Based on how I set it up, there probably is a better way. In fact, there is an ActiveRecord class in the wiki that could simplify CRUD… but it owuld be a start.

 
Posted: 10 May 2010 12:32 PM   [ Ignore ]   [ # 26 ]   [ Rating: 0 ]
Avatar
Joined: 2008-01-31
201 posts

Wow dude… nice ... such a time saver! I think your decision to keep it as a “form starter kit” is a good call.

I’m downloading this and installing it in my toolbox!

 Signature 

Greg Guepy - Skattabrain

 
Posted: 08 June 2010 11:54 PM   [ Ignore ]   [ # 27 ]   [ Rating: 0 ]
Joined: 2010-06-08
38 posts

I just found it - it’s really GREAT app!
Thank you so much! grin

I’m thinking about using it in my project, I don’t know if I will be able to do it, but I want to try this - if you don’t mind of cource:

Make a form with your app ->
the files will go automatically to a random-named directories in
  /controller/forms/_new_form_random_dir/
  /views/forms/_new_form_random_dir/
  /models/forms/_new_form_random_dir/
and the SQL would be automatically kicked making a random-named DB for the form.

The “random name” would be unique for every form and stored in separate DB - so calling for example form named “dummy45549” would call a DB named “dummy45549” and controller, view and model stored in:
  /controller/forms/dummy45549/
  /views/forms/dummy45549/
  /models/forms/dummy45549/

I don’t know if it’s possible but I will give it a try grin
If I succeed, I will post the files here (can I?).

Thanks once more for a great app and have a nice day grin

 
Posted: 09 June 2010 05:38 AM   [ Ignore ]   [ # 28 ]   [ Rating: 0 ]
Avatar
Joined: 2008-08-11
56 posts

Hey takasia,

takasia - 09 June 2010 03:54 AM

I just found it - it’s really GREAT app!
Thank you so much! grin

No problem, glad you find it useful.

takasia - 09 June 2010 03:54 AM

I’m thinking about using it in my project, I don’t know if I will be able to do it, but I want to try this - if you don’t mind of cource:

Make a form with your app ->
the files will go automatically to a random-named directories in
  /controller/forms/_new_form_random_dir/
  /views/forms/_new_form_random_dir/
  /models/forms/_new_form_random_dir/
and the SQL would be automatically kicked making a random-named DB for the form.

The “random name” would be unique for every form and stored in separate DB - so calling for example form named “dummy45549” would call a DB named “dummy45549” and controller, view and model stored in:
  /controller/forms/dummy45549/
  /views/forms/dummy45549/
  /models/forms/dummy45549/

I don’t know if it’s possible but I will give it a try grin
If I succeed, I will post the files here (can I?).

This all sounds very doable. Good luck smile You may find your proposed automatic setup is a little restrictive though when building a larger application. I tend to have multiple functions containing forms within a controller to keep related functions together. Separating as above may make things a little hard to manage.

Feel free to modify/change/distribute any code based on FormIgniter. It is distributed as open source with a MIT license so you can do anything you like with it. Would love to see your changes posted here.

 Signature 

FormIgniter - Easy form generator for the CodeIgniter framework
Too many tabs - My weblog about web app development, startups, productivity and life design
Barometer - The easiest way to add a stylish feedback form to your website.
My Github code - Sage Pay, Autoresponder, EPDQ libraries
Follow me on Twitter

 
Posted: 09 June 2010 06:35 AM   [ Ignore ]   [ # 29 ]   [ Rating: 0 ]
Joined: 2008-10-21
643 posts

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!

 
Posted: 09 June 2010 06:55 AM   [ Ignore ]   [ # 30 ]   [ Rating: 0 ]
Avatar
Joined: 2008-08-11
56 posts
mddd - 09 June 2010 10:35 AM

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!

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?

 Signature 

FormIgniter - Easy form generator for the CodeIgniter framework
Too many tabs - My weblog about web app development, startups, productivity and life design
Barometer - The easiest way to add a stylish feedback form to your website.
My Github code - Sage Pay, Autoresponder, EPDQ libraries
Follow me on Twitter

 
Posted: 09 June 2010 07:00 AM   [ Ignore ]   [ # 31 ]   [ Rating: 0 ]
Joined: 2008-10-21
643 posts

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.

 
Posted: 23 June 2010 12:57 AM   [ Ignore ]   [ # 32 ]   [ Rating: 0 ]
Avatar
Joined: 2010-02-11
13 posts

awesome app, this make my work easier
thx in million man

 
Posted: 05 October 2010 08:20 PM   [ Ignore ]   [ # 33 ]   [ Rating: 0 ]
Joined: 2009-09-11
6 posts

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

 
Posted: 19 November 2010 11:01 AM   [ Ignore ]   [ # 34 ]   [ Rating: 0 ]
Avatar
Joined: 2008-08-11
56 posts

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,

 Signature 

FormIgniter - Easy form generator for the CodeIgniter framework
Too many tabs - My weblog about web app development, startups, productivity and life design
Barometer - The easiest way to add a stylish feedback form to your website.
My Github code - Sage Pay, Autoresponder, EPDQ libraries
Follow me on Twitter

 
Posted: 16 February 2011 06:35 AM   [ Ignore ]   [ # 35 ]   [ Rating: 0 ]
Joined: 2007-11-09
181 posts

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?

 
2 of 4
2