Welcome Guest, Not a member yet? Register   Sign In
FormIgniter.org launched - Easy form generator - source code now available
#11

[eluser]drewbee[/eluser]
Very cool. From here on out, it's all about configuration!!!

For instance, I like to set my rules in 1 giant array, rather then seperate set rules function. This could be handled by a simple checkbox.

Code:
$rules = array(array('name' => 'field_name',
                     'label'=> 'Field Name',
                     'rules' => 'trim|callback__frank'),
         array('name' => 'field_name2',
                     'label'=> 'Field Name 2',
                     'rules' => 'trim|callback__frank2'),
              
             );

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">

Very cool start to something here though!!! Smile I guess from the configuration point, it's really just about building it to be completely custom to how the user outputs code. If I could specify how it builds the output in the view, controller, model etc that is even sicker!!
#12

[eluser]Ollie Rattue[/eluser]
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

[quote author="drewbee" date="1242259688"]Very cool start to something here though!!! Smile I guess from the configuration point, it's really just about building it to be completely custom to how the user outputs code. If I could specify how it builds the output in the view, controller, model etc that is even sicker!![/quote]

Again the arrays format is interesting, and feeds into a larger question about what FormIgniter is for. When I use FormIgniter myself, I take its output (or sometimes just a section of it) as my base from which I can then add the more bespoke features (AJAX, custom callbacks, session data, autoresponders etc).

FormIgniter saves me time, and means I don't have to do the boring drudge work. My idea was that 60-70% of building a validated form using CodeIgniters mechanisms is repition. If a code generator can do this for me then great!

However adding endless configuration options perhaps enters a situation of diminishing returns. As it is the interface is clean and IMO pretty easy to use. Perhaps it would be easy to complicate something that ultimate was designed for a simple task.

I intend to tidy the codebase up (horribly messy at the moment) and upload the source code. It would then be easy to customise the output to your way of working.

Thanks again for taking the time to post your thoughts.
#13

[eluser]Ollie Rattue[/eluser]
Source code finally available at http://formigniter.org/source_code
#14

[eluser]Phil Sturgeon[/eluser]
This should have a "more" button next to validation which could slide down an input box to write any validation rule in. Or it could use some reflection to get a list of all supported validation methods available (along the lines of get_class_methods.

It's a very snazzy little app though, good job! :-)
#15

[eluser]m4d3 Gun[/eluser]
I can't download....it

please...any another link...to get the source


thank's

M4d3
#16

[eluser]Ollie Rattue[/eluser]
Now corrected Smile
#17

[eluser]ururk[/eluser]
Nice tool!

One question - why are you not using form helper for all elements, eg:

Code:
<input id="test" type="text" name="test" value="<?php echo set_value('test'); ?>
vs

Code:
$data = array(
              'name'        => 'test',
              'id'          => 'test',
              'value'       => 'test'
            );

echo form_input($data);

I realize it is more code this way... but in some ways this makes the code reusable.

John
#18

[eluser]Ollie Rattue[/eluser]
[quote author="ururk" date="1254792480"]Nice tool!

One question - why are you not using form helper for all elements, eg:

Code:
<input id="test" type="text" name="test" value="<?php echo set_value('test'); ?>
vs

Code:
$data = array(
              'name'        => 'test',
              'id'          => 'test',
              'value'       => 'test'
            );

echo form_input($data);

I realize it is more code this way... but in some ways this makes the code reusable.

John[/quote]

Thanks for you useful feedback. I have not included the form helper for all the form elements, because I simply don't find it useful. A helper is meant to 'help' you write less code, however for a text input the code above is as long.

A example of a very useful form helper is for Selects, where an array can be passed for the options, and the select option can be easily repopulated. Writting this in html would take significantly longer.

Code:
<?php $options = array(
                      ''  => 'Please Select',
                      'example_value1' => 'example option 1'
                      'example_value2' => 'example option 2'
                      ); ?>

<br />&lt;?=form_dropdown('test', $options, set_value('test'))?&gt;

Another issue that prevents me from using html/form helpers, is that they tend to confuse frontend html/css developers. A frontend developer is able to work their way through html with the small bits of php code, but when it is all replaced with arrays and helpers of an unknown framework, it can often get confusing. It has then again ceased to add any benefit.

Finally it doesn't actually matter if the non-helper version is longer (which I don't think it is) as the writting of this code is automated by FormIgniter.

An option could be added to FormIgniter to output html or use the codeigniter helpers, but I think the time/gain ratio for this is low.

Opinionated software Smile
#19

[eluser]attos[/eluser]
Cool tool. I tried it and found one issue. I would expect not to specify a db field length on a text area connected to a text field.
Good work!
#20

[eluser]ururk[/eluser]
Found just one small bug (I think?)...


In your controller:

Code:
if ($this->myform_model->SaveForm($form_data)

In your model:

Code:
function save_form($form_data)

So it should be:

Code:
if ($this->myform_model->save_form($form_data)



Also, in your view:

Code:
echo form_open('my_form', $attributes); ?&gt;

Your class is 'Myform':

Code:
class Myform extends Controller {
              
    function Myform()

so it should be:

Code:
echo form_open('myform', $attributes); ?&gt;


Otherwise - pretty slick!




Theme © iAndrew 2016 - Forum software by © MyBB