newhck / php-form-builder-class

Automatically exported from code.google.com/p/php-form-builder-class
GNU General Public License v3.0
0 stars 0 forks source link

Form grid view #197

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. I used to use the project on 1.0 where their was a fantastic feature called 
map , which allowed us to arrange our fields on any grid layout we want. Looks 
like the feature is gone now.

I realized you have views to now handler layout, so I tried to create new grid 
view called "View_Grid", I am planning to use bootstrap grid system with 
controls-row here. I now need some way to pass map array to this new grid 
class, $view of Form class is protected otherwise I could have used that.

Any suggestions ?

What version of the product are you using? On what operating system?
PFBC 3.1 (PHP 5)

Original issue reported on code.google.com by kaushal....@gmail.com on 17 Mar 2013 at 4:28

GoogleCodeExporter commented 8 years ago
Hi,

I have attached both demo of grid view I created and view source.

But this is only possible if I can pass a mapping parameters to the view class 
like this on form setup:

$form->view->map=array('layout'=>array(2,3,2),'widths'=>array(6,6,4,4,4,6,6));

For now, I manually altered source code to make $view public instead of 
protected.

Thanks
Kaushal

Original comment by kaushal....@gmail.com on 17 Mar 2013 at 9:33

Attachments:

GoogleCodeExporter commented 8 years ago
Hi, I needed to mimic the behavior of the grid from version 2.3. I took your 
code and refactored a bit to get what I need. I have thrown in some custom 
elements and legacy code since I'm upgrading from version 2.3 of PFBC on an 
existing site. This will need to be cleaned up a bit to be merge-worthy. Note 
that modification of the core class is not required.

Usage: $form->configure(array(
            "view" => new PFBC\View\Grid(array("map"=>array(1, 3, 1, 1, 1, 1, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 4, 1, 2, 2, 1, 1)))
        ));

Notes: I use the legacy HTMLExternal element for things that shouldn't be 
forced into the grid. The Section and Csrf elements are some of my custom 
things... The former does the headings and the latter helps protect against 
cross-site request forgery.
I also added in some inline styling (see line 72) since I need the ability to 
hide certain elements and interact with certain elements via id (mostly used 
for a grid within a grid scenario). There's probably a better way to do all of 
this and I'd love to hear some feedback.

Original comment by pvcsnat...@gmail.com on 30 Jun 2013 at 7:53

Attachments: