⚠ 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

Crud Required_fields



Sofia Zahid
  • profile picture
  • Member

Posted 15 May 2013 - 10:23 AM

 please can some one help me this  function $crud->required_fields('city'); didn't work  in the exemple "Callback_add_field example .

 

 

 


 


davidoster
  • profile picture
  • Member

Posted 15 May 2013 - 11:27 AM

Hello and welcome to the forums.

Can you please paste your code here?


Sofia Zahid
  • profile picture
  • Member

Posted 15 May 2013 - 11:41 AM

thank's Mr;

 

the Code:

 

function offices_management()
{
try{
$crud = new grocery_CRUD();
 
$crud->set_theme('datatables');
$crud->set_table('offices');
$crud->set_subject('Office');
$crud->required_fields('city');
$crud->columns('city','country','phone','addressLine1','postalCode');
$output = $crud->render();
$this->_example_output($output);
}catch(Exception $e){
show_error($e->getMessage().' --- '.$e->getTraceAsString());
}
}

 


davidoster
  • profile picture
  • Member

Posted 15 May 2013 - 12:26 PM

Which version of Grocery CRUD are you using?

Make sure you have the latest stable one from here.


Sofia Zahid
  • profile picture
  • Member

Posted 15 May 2013 - 13:03 PM

I'm using Grocery CRUD v.1.3.3 (latest version)


davidoster
  • profile picture
  • Member

Posted 15 May 2013 - 20:58 PM

This is strange! Does it save and edit correctly at the database?


heruprambadi
  • profile picture
  • Member

Posted 16 May 2013 - 08:08 AM

are you using xampp ? what version ?


mnish
  • profile picture
  • Member

Posted 31 August 2013 - 17:02 PM

I think you have to use

 

$crud->fields('field1', 'city');

 

then

 

$crud->required_fields('city');

 

i am using it and it works fine.