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 - 12-27-2010

[eluser]seanloving[/eluser]
[quote author="darnold" date="1291949177"]Mac,

Is there a way to put sections of the form in different places in the view?

[/quote]

@darnold maybe this clever hint from Mac can help you too: http://ellislab.com/forums/viewthread/107861/P470/#716927

Anybody know a more elegant way?


Form Generation Library - El Forum - 12-31-2010

[eluser]BaRzO[/eluser]
Take a look at this one : http://thecodemine.org/#_demoForm=first


Form Generation Library - El Forum - 01-03-2011

[eluser]AndrewTurner[/eluser]
Hey Everyone,

I can't seem to get the form->db working for the life of me. I can't see what's wrong. It's like it's totally skipping the model call.

Any ideas?

Model Code
<code>
function add_group(&$form, $data) {

$form_data = array(
'groupname' => $data['group_name'],
);

$this->db->insert('groups', $data);

}
</code>

Controller
<code>
function add() {
$this->load->library('form');


$this->form
->open('groups/add', 'groups_add_form')
// Basic Info
->text('group_name', 'Group Name', 'required|max_length[255]')

->submit('Submit')

->validate()

->model('groups_model', 'add_groups')

->onsuccess('redirect', array('groups/index'));


$data['form'] = $this->form->get();
$data['errors'] = $this->form->errors;
$data['main_content'] = 'group_add';

$this->load->view('template', $data);
}
</code>

Thanks!


Form Generation Library - El Forum - 01-03-2011

[eluser]BaRzO[/eluser]
I think the add_groups should be add_group
Quote:->model(‘groups_model’, ‘add_groups’)



Form Generation Library - El Forum - 01-03-2011

[eluser]AndrewTurner[/eluser]
[quote author="Mustafa Kahraman" date="1294073286"]I think the add_groups should be add_group
Quote:->model(‘groups_model’, ‘add_groups’)
[/quote]

I noticed that soon after posting, fixed it.

Problem is still occuring unfortunately.

I'm on CI 1.7.3, Latest FGL and also using Modular Extensions, although this model is in the root models directory


Form Generation Library - El Forum - 01-03-2011

[eluser]Mat-Moo[/eluser]
You don't need validate() that's causing the issue.


Form Generation Library - El Forum - 01-03-2011

[eluser]AndrewTurner[/eluser]
[quote author="Mat-Moo" date="1294073945"]You don't need validate() that's causing the issue.[/quote]

Ah ha! Houston, we no longer have an issue.

Thanks very much, Can't believe I never picked up on that one


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

[eluser]sahanlak[/eluser]
Why it's applying "alass" instead of "class" ?

[Image: screenshot20110105at513.png]


Code:
$this->form
                ->open('add', 'add', 'class="form"')
                ->method('post')
                ->action('gallery/add')



Form Generation Library - El Forum - 01-10-2011

[eluser]macigniter[/eluser]
[quote author="sahanlak" date="1294249653"]Why it's applying "alass" instead of "class" ?[/quote]

This is a bug! You need to change the following two lines in the open() method:

Code:
if ($nameid) $this->_make_nameid($nameid, $atts);
$this->atts = $this->_make_info($atts);

must be:

Code:
$this->atts = $this->_make_info($atts);
if ($nameid) $this->_make_nameid($nameid, $this->atts);

I hope to update the library anytime soon with further fixes and updates. I have been very busy lately and didn't have that much time to support and update the library. But I am still working with it and have some updates available soon.

If anyone has found other bugs, updates or improvements please send them to me via email.


Form Generation Library - El Forum - 01-10-2011

[eluser]sahanlak[/eluser]
[quote author="macigniter" date="1294670100"][quote author="sahanlak" date="1294249653"]Why it's applying "alass" instead of "class" ?[/quote]

This is a bug! You need to change the following two lines in the open() method:

Code:
if ($nameid) $this->_make_nameid($nameid, $atts);
$this->atts = $this->_make_info($atts);

must be:

Code:
$this->atts = $this->_make_info($atts);
if ($nameid) $this->_make_nameid($nameid, $this->atts);

I hope to update the library anytime soon with further fixes and updates. I have been very busy lately and didn't have that much time to support and update the library. But I am still working with it and have some updates available soon.

If anyone has found other bugs, updates or improvements please send them to me via email.[/quote]


Thanks a lot, great plugin Smile.