In case you've missed it, you are looking at an older version of the website. Checkout our latest version, we promise you will love it 😍

required_fields

void required_fields( string $var [, string $var [, string $... ]]  )
Quick Description: Sets the required fields of add and edit fields.

Sets the required fields of add and edit fields.

function customers_management()
{
    $crud = new grocery_CRUD();
 
    $crud->set_table('customers');
    $crud->columns('customerName','contactLastName','phone','city','country','salesRepEmployeeNumber','creditLimit');
    $crud->display_as('salesRepEmployeeNumber','from Employeer')
             ->display_as('customerName','Name')
             ->display_as('contactLastName','Last Name');
 
    $crud->required_fields('customerName','contactLastName');
 
    $crud->set_subject('Customer');
    $crud->set_relation('salesRepEmployeeNumber','employees','lastName');
 
    $output = $crud->render();
 
    $this->_example_output($output);
}    
Note: The below example is an iframe so it might appeared with a scroll bar. If you like you can view the example on a new tab