⚠ 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

Edit form does not populate dropdown box



JMB
  • profile picture
  • Member

Posted 19 November 2018 - 17:55 PM

Hi there,

 

I am very new to GC and I am trying to edit a table with the following data:

 

CITY TABLE

id_city = Int, Primary key

city = varchar

id_country = FK into country table, Int

 

COUNTRY TABLE

id_country = Int, Primary key

country = varchar

 

The code to show this is:

	$crud = new grocery_CRUD();

	$crud->set_theme('datatables');
	$crud->set_table('tw_city');

	$crud->set_relation('id_country','tw_country','country');
	$crud->set_subject('City');

	$crud->columns('id_city','city','id_country');

	$output = $crud->render();
        $this->_example_output($output);

It shows the data correctly, but when I click EDIT it does not fill in the dropbox for the country field. What is odd is that if I select VIEW, it correctly shows the country associated with the selected item.

 

As far as I can see, I have set things up correctly.

 

Can anyone explain why the country dropdown does not fill on the edit page?

 

Thank you!

 

Yours,

 

JMB


stepgr
  • profile picture
  • Member

Posted 15 June 2020 - 10:19 AM

I also run into this  trouble today . Any GC  gurus that can explain this behavior ?