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 - 02-23-2010 [eluser]dinhtrung[/eluser] Hi, I can write form with jQuery Form plugin and FGL like this: Code: /** Controller **/ Code: /** View file **/ Form Generation Library - El Forum - 02-23-2010 [eluser]seanloving[/eluser] how do you break a form into parts? Or perhaps that is not necessary? Here is my goal: I am making a sales order form. At the top I want to show fields like Bill To, Ship To, Salesperson, Ship Date, etc… In the middle I show a table whose headings are QTY, PRODUCT, UNIT PRICE, and AMOUNT. Each row in the table represents a “sales order item”. ( Assume the table does NOT have any form elements) After the table and some other HTML, I want to show another form field for Notes and finally the form Submit button. Can I do this with a single form? Or do I need multiple forms? Thanks for any advice. Form Generation Library - El Forum - 02-23-2010 [eluser]BaRzO[/eluser] You can use ->html() method... Form Generation Library - El Forum - 02-23-2010 [eluser]seanloving[/eluser] [quote author="BaRzO" date="1266993591"]You can use ->html() method...[/quote] Yes. Maybe something like this. Load a view partial into the ->html() method.. Code: ->html( $this->load->view('salesorder_items', $data, true) ) Form Generation Library - El Forum - 02-24-2010 [eluser]macigniter[/eluser] [quote author="seanloving" date="1266991024"]how do you break a form into parts? Or perhaps that is not necessary? [/quote] I did the exact same thing in one of my recent projects. I inserted a delimiter to the form with Code: $this->form->html('--#--') (just use some symbols you will not use in your regular form output. Then I put the output of the form HTML in a variable and exploded this with Code: $form = $this->form->get(); Then you can use the individual form parts with $form[0] and so on and write them to individual areas in the view file. Form Generation Library - El Forum - 02-25-2010 [eluser]seanloving[/eluser] [quote author="dinhtrung" date="1266968715"]Hi, I can write form with jQuery Form plugin and FGL like this: [/quote] It works for me, but I don't use JQuery or Javascript very much (yet). How do I start learning what is possible with this plugin? --SL Form Generation Library - El Forum - 02-25-2010 [eluser]seanloving[/eluser] [quote author="macigniter" date="1267023546"][quote author="seanloving" date="1266991024"]how do you break a form into parts? Or perhaps that is not necessary? [/quote] I did the exact same thing in one of my recent projects. I inserted a delimiter to the form with Code: $this->form->html('--#--') (just use some symbols you will not use in your regular form output. Then I put the output of the form HTML in a variable and exploded this with Code: $form = $this->form->get(); Then you can use the individual form parts with $form[0] and so on and write them to individual areas in the view file.[/quote] AWESOME! This simple "trick" is VERY USEFUL! THANK YOU THANK YOU THANK YOU!!! Form Generation Library - El Forum - 02-25-2010 [eluser]BaRzO[/eluser] @seanloving I can recommend you following sites. http://net.tutsplus.com/ http://jqueryfordesigners.com/ http://www.learningjquery.com/ Form Generation Library - El Forum - 02-26-2010 [eluser]Unknown[/eluser] I propose a tiny code change. In the col() function change Code: $width = ($width) ? $width.'px' : 'auto'; Code: $width = ($width) ? $width : 'auto'; It's more flexible. Somebody like me (when making "fluid" design) may want to set for example ->col('30%') or even ->col('13em') Form Generation Library - El Forum - 03-02-2010 [eluser]joytopia[/eluser] Hello Frank, I am very glad, that I have found this great library! Thanks for that! A little problem: Code: ->open('settings','color_picker','id="test"') brings Code: <form action="http://mydomain.de/settings" cd="test" method="post"> I miss the second parameter, and the third parameter starts with cd=... instead of id=... "c" is the first letter of the second parameter. It seemes if something is wrong with function _make_info Best regards Bernd |