CodeIgniter Forums
Form Generation Library - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Form Generation Library (/showthread.php?tid=16439)



Form Generation Library - El Forum - 07-18-2010

[eluser]nearo[/eluser]
Thank you for the response I appreciate your help and insights. I am only looking to make a form mail, a contact form on a website, nothing more, but for simplicity sake it is much easier if the FROM shows as the person who filled out the form. It seems simple enough to do and was curious if anyone found the trick in setting it this way.

Thank you again.


Form Generation Library - El Forum - 07-18-2010

[eluser]BaRzO[/eluser]
Okey. I get you now.

You can generate your form with formlib and Email class when the form submitted and if there is no errors to show user you can use Email class and you can add email class config $this->email->reply_to('reply@ example.com') for to reply address thats it.


Form Generation Library - El Forum - 07-19-2010

[eluser]joytopia[/eluser]
[quote author="joytopia" date="1279120423"]
after CI's security patch
http://codeigniter.com/news/codeigniter_1.7.2_security_patch/
iupload does not work any more...
[/quote]

Found it out:
preference ‘file_name’ in CI's file uploading class now must contain the file extension (.jpg, .gif etc.)

Best regards
Bernd


Form Generation Library - El Forum - 07-22-2010

[eluser]groyk[/eluser]
Hi MacIgniter

Just upgraded to ver. 1.01

But I am having troubles with validation :-(

Please look at my code

Code:
# Makes jQuery multiselect for roles
            $this->jscss->multiselect('multiselect');
    
        # Form
            $this->form->open(site_url('auth/create_user'),'create')
                ->checkbox('active','')
                ->text('username','','required|min_length[3]|alpha_dash')
                ->text('name','','required|min_length[3]')
                ->text('email','','required|valid_email')
                ->select('roles|roles', $this->s_auth->roles2select(), 'Select multiple', ',', '',array('style' => 'width:450px;height:100px;', 'class'=>'multiselect'))
                ->submit('Save')
                //->get() I HAVE TO REMOVE THIS GET() IN ORDER TO NOT RECIEVE ANY FAILURE
                ;                
                        
                if(isset($_POST['username']) and $this->form->valid)
                {
                    if($this->s_auth->register($_POST['username'], '', $_POST['email'], $_POST['name'], @$_POST['multiSelect-options-roles'], @$_POST['active'], TRUE, FALSE )==TRUE)
                            redirect('/auth/users');
                }
                
                $data['form'] = $this->form->get_array();
                $this->msg->set($this->form->errors); // THIS DOES NOT PRODUCE ANY ERROR
        
        # Output layout
            $this->layout->view("create_user",$data);

In ver. 0.2 i had to have both ->get and ->get_array in order to validate corect!

Right now I have solved the issue by comment out line 1465 and 1487 in the library.
But this is of-course a really bad idea. But right now my only solution!


Form Generation Library - El Forum - 07-23-2010

[eluser]groyk[/eluser]
Hi MacIgniter

Just found a small bug in your library.

when i try to post arrays the ->get_post method fails.


print_r shows following
Code:
[header[da]] =>
[sub_text[da]] =>
[description[da]] =>
[header[en]] =>
[sub_text[en]] =>
[description[en]] =>
[header[de]] =>
[sub_text[de]] =>
[description[de]] =>

The right output should be
Code:
[header] => Array
      (
           [da] =>
           [en] =>
           [de] =>
      )
[sub_text] => Array
      (
           [da] =>
           [en] =>
           [de] =>
      )
[description] => Array
      (
           [da] =>
           [en] =>
           [de] =>
      )

Fields are created like this in the controller

Code:
foreach($languages as $key => $lang)
                {    
                    $this->form->text("header[$key]|header$key",'Header','max_length[50]|xss_clean',@$stock['header_'.$key],array('class' => 'large'))
                    ->text("sub_text[$key]|sub_text$key",'Subtext','max_length[50]|xss_clean',@$stock['sub_text_'.$key],array('class' => 'large'))
                    ->textarea("description[$key]|description$key",'Description','xss_clean',@$stock['description_'.$key],array('class' => 'description'))
                    ;
                }



Form Generation Library - El Forum - 07-30-2010

[eluser]Mat-Moo[/eluser]
Hi Mack

I'm using this lib now on all my projects, but I've just hit a snag. I need to add
Code:
<div class="xxx">
&lt;form&gt;
  <dl class="zs">
   ... fields wrapped with dd
  </dl>
&lt;/form&gt;
</div>
I tried to use html before the form open but it still comes in after the form open. TIA Smile


Form Generation Library - El Forum - 08-03-2010

[eluser]ortenheim[/eluser]
wow 55 pages...can this library be used to create forms from the database? by sending it arrays?


Form Generation Library - El Forum - 08-04-2010

[eluser]hugle[/eluser]
[quote author="ortenheim" date="1280853764"]wow 55 pages...can this library be used to create forms from the database? by sending it arrays?[/quote]

Well, I didn't see any live example,
but actually you can, grab array from database, and make a foreach loop.

Try to use it, you'll see it's very simple and easy to useSmile

from post on page #55, there is a little example of this:
Code:
foreach($languages as $key => $lang)
                {    
                    $this->form->text("header[$key]|header$key",'Header','max_length[50]|xss_clean',@$stock['header_'.$key],array('class' => 'large'))
                    ->text("sub_text[$key]|sub_text$key",'Subtext','max_length[50]|xss_clean',@$stock['sub_text_'.$key],array('class' => 'large'))
                    ->textarea("description[$key]|description$key",'Description','xss_clean',@$stock['description_'.$key],array('class' => 'description'))
                    ;
                }

Now you can have a better idea of what I am talking about


Form Generation Library - El Forum - 08-04-2010

[eluser]Frank Rocco[/eluser]
I tried your demo login.
Getting an error.

A PHP Error was encountered
Severity: Warning

Message: call_user_func_array() expects parameter 2 to be array, string given

Filename: libraries/Form.php

Line Number: 1991


Form Generation Library - El Forum - 08-07-2010

[eluser]Mat-Moo[/eluser]
I've just got that exact error running this lib on xaampp lite 1.7.3, any ideas?