⚠ 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

unset add/edit field



HellKnight
  • profile picture
  • Member

Posted 16 October 2012 - 11:36 AM

How can I make CRUD not change anything when you add or update. Here is my source code.

function prod_set($id_ps = 0)
{
try{
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('prods_set');
$crud->set_subject('Product set');
if($id_ps != 0){$crud->where('ps_id',$id_ps);}

$crud->add_fields('prod_set_name', 'vendor_id','arcticle', 'id_type', 'add_data','Application','Colors','Image');

$crud->set_relation('id_type','type','type_name');
$crud->set_relation('vendor_id','vendors','name');

$crud->set_relation_n_n('Application', 'application_prod_set', 'application', 'id_prod_set', 'id_app', 'app_name');
$crud->set_relation_n_n('Colors', 'color_prod_set', 'colors', 'prod_set_id', 'color_id', 'name');
$crud->set_relation_n_n('Image', 'prod_set_images', 'images', 'prod_set_id', 'images_id', 'url');

$crud->callback_column('Image',array($this,'get_img'));
$crud->callback_edit_field('Image',array($this,'edit_field_callback_1'));
$crud->callback_add_field('Image',array($this,'add_field_callback_1'));


$crud->unset_fields('Image');
$crud->unset_back_to_list();

$output = $crud->render();

$this->_example_output($output);
}catch(Exception $e){
show_error($e->getMessage().' --- '.$e->getTraceAsString());
}
}

Masmuh Vítězství
  • profile picture
  • Member

Posted 02 March 2013 - 11:29 AM

make readonly field name,example : 

 

$crud->set_rules('vendor_id','readonly');


davidoster
  • profile picture
  • Member

Posted 03 March 2013 - 11:16 AM

Check the field_type function.