EllisLab text mark
Advanced Search
1 of 49
1
   
Form Generation Library
Posted: 06 March 2009 01:43 PM   [ Ignore ]
Avatar
Joined: 2008-06-23
252 posts

New version 2.0.2 available!
Please read the changelog before downloading and upgrading

Welcome to the home of the Form Generation Library, a project that will help you to accelerate your form creation and reduce your coding efforts.

The Form Generation Library is based on the idea of Benjamin Midget’s Midget Forms (which is no longer actively developed) and is maintained and developed by Frank Michel. I am always looking forward to code improvements or bug reports, so if you find anything please let me know [info at frankmichel dot com]! I’d love to include it in the next release.

The library is generating valid XHTML and utilizes CI’s form validation including the support of custom callback functions. Take a look at the demo form.

I have developed a user guide that gives you some help in understanding how the library works.

If you download the files you will also find lots of comments that will explain how to use the library and its methods. You can choose between two download options (with or without user guide).

Please see the user guide for installation guidelines.

The user guide also provides important information about the config file and usage of the various form elements.

Last, but not least please take a look at the release notes to keep up with the latest updates and changes.

I hope you enjoy the library and help to make it even better. If you’re using it for commercial projects I would appreciate a small donation. As a thank you please grab one of the Form Generation Library Quick Reference guides.

Cheers,
Frank

IMPORTANT:
Verson 2.0 requires CodeIgniter > 2.0.0

Verson 1.0 includes major udpates and changed syntax in various places. Please read the upgrade instructions on the download page.

Version 0.1.5 changes the way the config file is set-up. Please read the user guide and change your existing config files to match the new standard.

 Signature 

Tired of forms? Check out Form Generation Library

 
Posted: 06 March 2009 02:05 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2009-02-12
263 posts

I’m very interested in this, please keep us (or me) posted.

 Signature 

.htaccess mod_rewrite no longer working when moving from the development server to production server?

Check that you have AllowOverride All in your host config file for the public web directory of your website.

AND USE THE FRACKING SEARCH!!!  it works, it really does!

 
Posted: 06 March 2009 02:29 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2006-05-29
277 posts

Wow!!!! i’m very interest also

 Signature 

CI Js_calendar plugin click

WYSIWYG with CI

 
Posted: 06 March 2009 02:41 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2008-01-17
426 posts

Post the PHP file or its not true!!! haha jk but i would be happy to test it out for you and give feedback.

 Signature 

aka trs21219
CodeSanity | Github | LinkedIn | Facebook | Twitter | Last.fm

 
Posted: 06 March 2009 03:18 PM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Avatar
Joined: 2009-02-26
66 posts

I only hope it’s true, I’ll kiss the ground you walk for this one!

 
Posted: 06 March 2009 09:01 PM   [ Ignore ]   [ # 5 ]   [ Rating: 0 ]
Avatar
Joined: 2006-07-27
2617 posts

Been wanting to do this myself for some time now. There are other versions out there, but I’ll be interested to see what you’ve done.

 Signature 

Check out the Template Library
Oh yeah, I tweet, too (regarding CodeIgniter on occassion).

 
Posted: 07 March 2009 03:08 PM   [ Ignore ]   [ # 6 ]   [ Rating: 0 ]
Avatar
Joined: 2008-06-23
252 posts

I knew this one would draw attention smile But the good news is that it really is true and I am working hard to release it asap. The inspiration came from Benjamin Midget’s MidgetForms which was a great approach but unfortunately never got to version 1.0. Since i needed form generation asap i decided to build a library myself.

I added error handling today so the script auto validates the code and checks for correct syntax when adding elements to the form.

As a sneak peek these are the element methods which will be available in the library:

->fieldset(STR legend [, ARR|STR attributes])
->hidden(STR name|id [, STR value])
->label(STR label, STR for [, ARR|STR attributes])
->text(STR name|id [, STR label, STR rules, STR value, ARR|STR attributes])
->password(STR name|id [, STR label , STR rules, STR value, ARR|STR attributes])
->textarea(STR name|id [, STR label, STR rules, STR value, ARR|STR attributes])
->upload(STR name|id [, STR label, BOOL required, ARR|STR attributes])
->iupload()
->select(STR name|id, ARR options [, STR label, ARR|STR selected, STR rules, ARR|STR attributes])
->checkbox(STR name|id, STR value [, STR label, BOOL checked, STR rules, ARR|STR attributes])
->checkgroup(STR name, ARR checks [, ARR|STR checked, STR rules, ARR|STR attributes])
->radiogroup(STR name, ARR radios [, ARR|STR checked, STR rules, ARR|STR attributes])
->button(STR content [, STR name|id, STR type, ARR|STR attributes])
->image(STR src [, STR name|id, ARR|STR attributes])
->submit([STR value, STR name|id, ARR|STR attributes])
->reset([STR value, STR name|id, ARR|STR attributes])
->span(STR content [, ARR|STR attributes])
->html(STR content)
->br()
->hr()
->space()

To add an element id you can pipe the name parameter like “elname|elid” where the id is an optional parameter. If an id is mandatory (such as for a label’s for attribute) and you didn’t specify it the library will automatically generate a unique id for you.

Moreover there will be lots of methods to add classes, rules, errors, attributes, etc.

I’ll keep you all posted!

 Signature 

Tired of forms? Check out Form Generation Library

 
Posted: 07 March 2009 05:41 PM   [ Ignore ]   [ # 7 ]   [ Rating: 0 ]
Avatar
Joined: 2009-02-12
263 posts

any info on doctype?  will it support both html and xhtml? 

what about the form tag attribs?  name, id, action, enctype, etc?

 Signature 

.htaccess mod_rewrite no longer working when moving from the development server to production server?

Check that you have AllowOverride All in your host config file for the public web directory of your website.

AND USE THE FRACKING SEARCH!!!  it works, it really does!

 
Posted: 07 March 2009 06:51 PM   [ Ignore ]   [ # 8 ]   [ Rating: 0 ]
Avatar
Joined: 2009-02-26
66 posts

I want to see some example of usage wink

macigniter - 07 March 2009 08:08 PM

I knew this one would draw attention smile But the good news is that it really is true and I am working hard to release it asap. The inspiration came from Benjamin Midget’s MidgetForms which was a great approach but unfortunately never got to version 1.0. Since i needed form generation asap i decided to build a library myself.

I added error handling today so the script auto validates the code and checks for correct syntax when adding elements to the form.

As a sneak peek these are the element methods which will be available in the library:

->fieldset(STR legend [, ARR|STR attributes])
->hidden(STR name|id [, STR value])
->label(STR label, STR for [, ARR|STR attributes])
->text(STR name|id [, STR label, STR rules, STR value, ARR|STR attributes])
->password(STR name|id [, STR label , STR rules, STR value, ARR|STR attributes])
->textarea(STR name|id [, STR label, STR rules, STR value, ARR|STR attributes])
->upload(STR name|id [, STR label, BOOL required, ARR|STR attributes])
->iupload()
->select(STR name|id, ARR options [, STR label, ARR|STR selected, STR rules, ARR|STR attributes])
->checkbox(STR name|id, STR value [, STR label, BOOL checked, STR rules, ARR|STR attributes])
->checkgroup(STR name, ARR checks [, ARR|STR checked, STR rules, ARR|STR attributes])
->radiogroup(STR name, ARR radios [, ARR|STR checked, STR rules, ARR|STR attributes])
->button(STR content [, STR name|id, STR type, ARR|STR attributes])
->image(STR src [, STR name|id, ARR|STR attributes])
->submit([STR value, STR name|id, ARR|STR attributes])
->reset([STR value, STR name|id, ARR|STR attributes])
->span(STR content [, ARR|STR attributes])
->html(STR content)
->br()
->hr()
->space()

To add an element id you can pipe the name parameter like “elname|elid” where the id is an optional parameter. If an id is mandatory (such as for a label’s for attribute) and you didn’t specify it the library will automatically generate a unique id for you.

Moreover there will be lots of methods to add classes, rules, errors, attributes, etc.

I’ll keep you all posted!

 
Posted: 07 March 2009 08:43 PM   [ Ignore ]   [ # 9 ]   [ Rating: 0 ]
Joined: 2008-09-12
49 posts

This seems very interesting, looking forward to it.

 Signature 

Personal Site | Twitter

 
Posted: 08 March 2009 01:25 AM   [ Ignore ]   [ # 10 ]   [ Rating: 0 ]
Avatar
Joined: 2008-07-28
511 posts

Very cool. One of these days I need to get around to doing this for myself, as I invision validation / form configuration working seemlessly together. This is what I am looking to do:

$fields = array(
                array(
'type'         => 'input',
                      
'name'         => 'test',
                      
'id'             => 'test',
                      
'label'         => 'Test Input:',
                      
'class'         => 'field',
                      
'attr'        => '',
                      
'default'     => 'Default Value',
                      
'max_length'     => '50',// If set, will also set validation rule automatically to max_length
                      
'rules'        => 'required|callback__validateTest'),
                
                array(
'type'         => 'select',
                      
'name'         => 'test2',
                      
'id'             => 'test2',
                      
'label'         => 'Test Select 2:',
                      
'class'         => 'select',
                      
'attr'        => '',
                      
'default'     => '0',
                      
'lookups'     => array('0' => 'value 1''1' => 'value 2'),// form validation will now check for what has been posted and verify it is in this array key
                      
'rules'        => 'required|callback__validateTest'),                      
            );
$form create_form('form_name''action''id="bob"|style="width:234px;"'$fields); 

That’s my dream anyways. Views would pretty much be obsolete as they are all configured in the controller. Just the standard view_form view could be called.

I really should get crackin on this eh?

 Signature 

~ 4 All the Right Reasons ~

 
Posted: 08 March 2009 09:41 AM   [ Ignore ]   [ # 11 ]   [ Rating: 0 ]
Avatar
Joined: 2008-06-23
252 posts

Let me give you a usage example for the form in the previous post:

First of all, in the config file you would set “name_as_id” to TRUE, so all names will be converted to id’s (if applicable). So no need to manually provide id’s for all the elements (you can still do if you like, though).

$select = array('value 1''value 2''value 3'); // no need to provide keys since they start with 0

$form = new Form();
$form
->open('action''form_name|bob''style=width:234px')
->
text('test''Test Input''required|callback_validateTest|maxlength[50]''Default Value''class=field')
->
select('test2'$select'Test Select 2:'0'required|callback_validateTest''class=select');

echo 
$form->get(); 

That’s it. Of course you could put the classes in the config file to save you some typing. Oh and my approach with maxlength was the other way around. If you apply a maxlength validation rule the library will automatically set the maxlength attribute for you.

 Signature 

Tired of forms? Check out Form Generation Library

 
Posted: 08 March 2009 09:45 AM   [ Ignore ]   [ # 12 ]   [ Rating: 0 ]
Avatar
Joined: 2008-06-23
252 posts
brianw1975 - 07 March 2009 10:41 PM

any info on doctype?  will it support both html and xhtml? 

what about the form tag attribs?  name, id, action, enctype, etc?

The library utilizes CI’s form helpers, so the output code is dependent on that.

Please see my previous post for the form tag attributes. You can use:

->open(STR action [, STR name, STR|ARR attributes])

 Signature 

Tired of forms? Check out Form Generation Library

 
Posted: 23 March 2009 04:03 AM   [ Ignore ]   [ # 13 ]   [ Rating: 0 ]
Avatar
Joined: 2009-02-20
166 posts

I’m a Newbie, therefore it sounds very interesting, looking forward to it. Any help/action wanted?

 
Posted: 23 March 2009 11:02 AM   [ Ignore ]   [ # 14 ]   [ Rating: 0 ]
Joined: 2008-07-31
194 posts
$fields = array(
                array(
'type'         => 'input',
                      
'name'         => 'test',
                      
'id'             => 'test',
                      
'label'         => 'Test Input:',
                      
'class'         => 'field',
                      
'attr'        => '',
                      
'default'     => 'Default Value',
                      
'max_length'     => '50',// If set, will also set validation rule automatically to max_length
                      
'rules'        => 'required|callback__validateTest'),
                
                array(
'type'         => 'select',
                      
'name'         => 'test2',
                      
'id'             => 'test2',
                      
'label'         => 'Test Select 2:',
                      
'class'         => 'select',
                      
'attr'        => '',
                      
'default'     => '0',
                      
'lookups'     => array('0' => 'value 1''1' => 'value 2'),// form validation will now check for what has been posted and verify it is in this array key
                      
'rules'        => 'required|callback__validateTest'),                      
            );
$form create_form('form_name''action''id="bob"|style="width:234px;"'$fields); 

Couldn’t have said it better myself

 Signature 

Spam Helper | Html Helper | GPoll Library | IMAP Library

 
Posted: 23 March 2009 01:53 PM   [ Ignore ]   [ # 15 ]   [ Rating: 0 ]
Avatar
Joined: 2008-06-23
252 posts

Sorry I haven’t been posting in a while. I was traveling and just got back to working on the library. I am currently testing it and refining the code. I am also working on a user guide which will explain all methods and element usage.

You can see a working demo of the library by visiting this page:
Form Generation Library Examples

I used some different configurations, label positioning as well as error display (on top, inline as image with title, inline as text). Since I saw some requests about error messages per field (opposed to per rule) I have also added this feature. You can see it in action if you delete the default content in the “Notes” textarea and then post the form.

The user guide is available here, but still needs work on lots of the pages. But you can go ahead and check out the element usage which is almost already finished.

As soon as I will release the first version of this library I am happy about receiving your feedback and inputs.

 Signature 

Tired of forms? Check out Form Generation Library

 
1 of 49
1