PageRenderTime 19ms CodeModel.GetById 10ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/README.markdown

https://bitbucket.org/kindari/codeigniter-autoform/
Markdown | 57 lines | 36 code | 21 blank | 0 comment | 0 complexity | ee0ed10a9c76834d26ab3a0623e92c55 MD5 | raw file
 1#Codeigniter Autoform
 2
 3##How to use?
 4
 5Autoform is for lazy people like me :) It extends the form helper functions and adds auto detection of field type and building the complete form.
 6
 7##Display Methods
 8Currently the system outputs a table, but there is support for multiple display methods for when I add others. The table that is built consists of one form label and element per table row.
 9
10##Examples
11###Quick form
12    <?php echo new Autoform('username', 'password');
13
14!(http://kindari.net/autoform/autoform-username-password.png)
15
16###From database result
17
18    <?php
19    $query = $this->db->where('id',1)->get('profiles');
20    $result = $query->row();
21    var_dump($result);
22    $form = new Autoform($result);
23    echo $form;
24
25!(http://kindari.net/autoform/autoform-db-result.png)
26
27##Beyond Guessing
28Autoform guesses what it should do with whatever you hand to it. But what if what you hand to it came from a database, and there are somethings in that database you don't want to include in the form? Or if you need to confirm something, like an email or password? or if a value should be hidden, like an id?
29
30All examples below will follow $form being assigned from the following code:
31
32    <?php
33    $query = $this->db->where('id',1)->get('profiles');
34    $result = $query->row();
35    $form = new Autoform($result);
36
37
38
39###Ignore fields
40You can have Autoform ignore fields by calling the ignore method.
41
42    <?php $form->ignore('phone');
43
44###Confirm fields
45Need to confirm a password or email address entered? Simple!
46
47    <?php $form->confirm('email');
48
49###Hidden fields
50Hidden fields are also easily added. By default, an element named 'id' will be set to hidden.
51
52    <?php $form->hidden('city');
53
54###The result
55Combining all three of the above methods we get:
56
57!(http://kindari.net/autoform/autoform-custom.png)