GroceryCRUD: how to set a drop down box

I'm just code with GroceryCRUD, This is my database:

a_guest_data strong>

guest_no
register_date 
name 
gender 
birthday 
address 
city 
country 
phone 
email 
ref 
status 
date_modified

a_table_data strong>

id_table 
tbl_name 
group_name 
status 
seat 
party_date 
locked 
pos_tbl 
date_modified

a_table_group

id_table 
guest_no 
priority

This is my code for the controller:

public function guest_management()
{
    $crud = new grocery_CRUD();

    $crud->set_table('a_guest_data');
    $crud->set_subject('Guest');
    $crud->set_relation_n_n('tables', 'a_table_group', 'a_table_data', 'guest_no', 'id_table', 'tbl_name');
    $crud->unset_columns('register_date','layout_no', 'date_modified', 'ref');

    $crud->fields('name', 'register_date', 'gender', 'birthday', 'tables', 'address', 'city', 'country', 'phone', 'email', 'ref', 'status' );


    $crud->field_type('country','dropdown', array('Indonesia' => 'Indonesia', 'Others' => 'Others'));
    $crud->field_type('gender','dropdown', array('Male' => 'Male', 'Female' => 'Female'));
    $crud->field_type('status','dropdown', array('1' => '1', '2' => '2'));

    $output = $crud->render();

    $this->_example_output($output);
}

And I have this form enter image description hereenter image description here

In the “Tables” field, I want to set the drop-down fields that can only select one table (“Fact”, now in the “Tables” field, I can choose many options. * See in the picture, I select Table 1, 45, 6 , 34).

How can i do this?

+4
source share
1 answer

You are using an input with multiple inputs, try removing the MULTIPLE markup. It depends on what type of choice you are using.

0

Source: https://habr.com/ru/post/1569107/


All Articles