⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Multiple Edit forms



John S Renor
  • profile picture
  • Member

Posted 28 August 2012 - 13:03 PM

I wonder if its possible to have different (multiple) edit forms using custom actions.
for example,
I can add/edit basic details (like Name, Email) with default add/edit buttons.
I need to add a custom action button (say 'Edit More details'). but this should be redirected to a different form with different fields.

please guide me how to do it if its possible.

dwasden
  • profile picture
  • Member

Posted 12 October 2012 - 05:49 AM

I have a similar request. How did you resolve this John? I want to show a button on the edit form only to allow a user to modify related data.

victor
  • profile picture
  • Member

Posted 12 October 2012 - 08:11 AM

Hi! You can to use the method "add_action".


function example()
{
$crud = new grocery_CRUD();
$crud->set_table('your_table');
$crud->columns(...);

if($this->input->get('method')=='more_details')
{
$crud->edit_fields('more','fields');
}
else
{
$crud->edit_fields('your','basic','fields');
}

$crud->add_action('basic details', '', '','',array($this,'more_details'));
$output = $crud->render();
$this->_example_output($output);
}

function more_details($primary_key , $row)
{
return site_url('demo/example/edit/'.$row->id.'?method=more_details');
}