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 - 04-01-2010

[eluser]mahrizal[/eluser]
[quote author="hugle" date="1270121627"][quote author="mahrizal" date="1270111710"]i use this form
and success
but i wanna add captcha in my form
can anybody help me?[/quote]

Hi.
you can use built-in recaptcha : http://www.frankmichel.com/formgenlib/user_guide/elements/recaptcha.html

Good luck[/quote]

thanks hugle


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

[eluser]Mat-Moo[/eluser]
Hmm, got a problem! I have a select with a few hundred items in it (List of business schools with Multi select), however if the user picks a lot, then the form never seems to validate. Although it could be me using it wrong!
Code:
$this->form
->select('busschool',$schoolarray,'Business schools', $this->input->post('busschool'),"","multiple=TRUE");

$this->data["form"] = $this->form->get();
$this->data["error"] = $this->form->errors;

if ($this->form->valid)
{
// perform a search using the busschool data selection
}
I know this is not the conventional way to use the form, but it allows me to keep the form and show the results on the same page (And I collapse the search at the top for editing).

So how comes this works perfectly... till you pick a LOT of schools?

Any clues welcome!


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

[eluser]Mat-Moo[/eluser]
Actually I don't think this is form generator related - I've even added a debug to the input.php class file at start and even there I have less than 200 items from my select list?!


Form Generation Library - El Forum - 05-01-2010

[eluser]BaRzO[/eluser]
Hi all,
I use Ubuntu and I upgraded to 10.04 today php version also upgraded to 5.3.2 and I get split error
on line 891 and 896
I changed split to explode is it right to change split with explode ?

Quote:split() PHP 5.3.0, the regex extension is deprecated in favor of the PCRE extension. Calling this function will issue an E_DEPRECATED notice.



Form Generation Library - El Forum - 05-13-2010

[eluser]seanloving[/eluser]
I use a naming convention that has been working great with the ->text() method, but I just found a problem when I try to apply the same naming convention to the ->checkbox() method

for example, my naming convention is like this
Code:
->text('name|nameID', 'Company', 'trim',  $this->input->post('name') )
but this code
Code:
->checkbox('customer_type|customer_typeID', $this->input->post('customer_type'), 'person' )
is giving me this error:
Code:
A PHP Error was encountered

Severity: Warning

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

Filename: libraries/Form.php

Line Number: 1676

It seems like the problem is when the checkbox name is the same as the variable name of the posted value. In this example 'customer_type'.

If I change the name of the post variable or if I change the name checkbox, then it works without the error.

--Sean Loving


Form Generation Library - El Forum - 05-13-2010

[eluser]BaRzO[/eluser]
why you using $this->input->post('customer_type') you dont have to use this.
formlib can remember the form values when its posted.


Form Generation Library - El Forum - 05-13-2010

[eluser]seanloving[/eluser]
[quote author="BaRzO" date="1273810270"]why you using $this->input->post('customer_type') you dont have to use this.
formlib can remember the form values when its posted.[/quote]
I do it to pre-load the form with database data, upon request to edit a customer record. Yes I know the formlib saves the data after submit, but I need data pre-filled before submit


Form Generation Library - El Forum - 05-14-2010

[eluser]BaRzO[/eluser]
I do update like this...
the $groups looks like
Code:
$groups = array ( 1 => 'Admin', 2 => 'Moderator' );
Code:
function edit_user() {
        $id = $this->uri->segment(2);

        $groups = $this->group_model->get_groups();
        $sql = $this->db->where('user_id', $id)->get('users');

        $sql = $sql->row();

        $this->form->open('admin/products/products_edit/'.$id)
                ->fieldset('Edit User Data')

                ->select('user_group', $groups, 'User Groups', $sql->group_id, 'trim|required|callback__group_check')


                ->text('user_name', 'User Name', 'trim|max_length[150]', $sql->user_name)

                ->hidden('user_id', $id)

                ->indent('210')
                ->submit('Save');
        $this->form->validate();

        if ($this->form->valid) {
            $data = $this->form->get_post();

            if ( $this->users->save($data, $id) ) {
                echo "user updated";
            }
        }

    } // end edit_user

In your code
Change this
->checkbox('customer_type|customer_typeID', $this->input->post('customer_type'), 'person')
to
->checkbox('customer_type|customer_typeID', 'yes', 'Person', $this->input->post('customer_type'), 'trim|xss_clean')


Check User Guide


Form Generation Library - El Forum - 05-16-2010

[eluser]hardik[/eluser]
http://www.frankmichel.com/download/get/1

doesnot works for me. it says...
Code:
http://img183.imageshack.us/img183/3264/84999604.jpg

any problem in server ?


Form Generation Library - El Forum - 05-17-2010

[eluser]BaRzO[/eluser]
I think he is updating his web site.
Here is the latest version, You can download it.