[Plugins] buildFormProcessor

A place to share your Plugins and Extensions

[Plugins] buildFormProcessor

Postby fc_Damir » Wed Jan 19, 2011 2:01 pm

Hi,

I want to share with raxan community this new plugins inspired by buildForm of Raymond.
Thanks to buildFormProcessor you can generate form and process it only giving table name.
Now with tableBuilder and formBuilderProcessor you can create a generic method to build table with action edit / insert new record.

Usage:

Build form
Code: Select all
   
  protected function _indexView(){
    $this->loadPlugin("formbuilderprocessor", "form"); //load plugin
    $this->form->init($this->db); //init plugin
    $this->form->setColumnTable("blogposts"); //set database table name
    $this->form->removeField("id"); //remove field id
    $this->form->setLabel("id_user", "User"); //change label field id_user
    $this->formbuilder->html($this->form->buildForm()); //build form
  }


Process form
Code: Select all
  protected function _processView(){
    $this->loadPlugin("formbuilderprocessor", "form"); //load plugin
    $this->form->init($this->db); //init plugin
    $this->form->setColumnTable("blogposts"); //set database table name
    $post = $this->post->filterValues(); //get post
    if($this->form->process($post)) $this->formbuilder->html("Success"); //process form
    else $this->formbuilder->html("Error");
  }


Enjoy!
Attachments
raxan.zip
files with plugin and example of usage
(1.94 KiB) Downloaded 162 times
fc_Damir
 
Posts: 33
Joined: Mon Jun 14, 2010 9:13 am

Re: [Plugins] buildFormProcessor

Postby raymond » Thu Jan 20, 2011 2:53 am

Hi Damir,

Very nice. Thanks for sharing.
raymond
Site Admin
 
Posts: 215
Joined: Tue Mar 17, 2009 5:04 am


Return to Plugins & Widgets

Who is online

Users browsing this forum: No registered users and 1 guest

cron