Hello: I have a grid which displays data from the following two tables correctly:
$grid->SelectCommand = ‘SELECT a.idresearch, b.idplant, b.name, b.latin_name, a.Article, a.Citation, a.plant_idplant FROM research a, plant b WHERE a.plant_idplant=b.idplant’;
I am trying to set autocomplete so that when adding a record the user can select either name or latin_name and it will complete a.plant_idplant with the value from b.plantid.
Creating a column called plant_name in table a and setting it up like so : $grid->setAutocomplete(“latin_name”,”#plant_name”,”SELECT latin_name, latin_name, plant_name FROM plant WHERE latin_name LIKE ? ORDER BY latin_name”,null,true,true); – works and gives me the dropdown box and selectability I wanted and writes the selected name into the research table but I really need the idplant value not the plant name. Inserting b.idplant like so $grid->setAutocomplete(“latin_name”,”plant_idplant”,”SELECT b.idplant, b.latin_name, a.plant_idplant FROM research a, plant b WHERE b.latin_name LIKE ? ORDER BY b.latin_name”,null,true,true); gets the add form to show the idplant number instead of the name but writes a zero instead of the correct value to plant_idplant.
Can you tell me how I can get the idplant value for name from the autocomplete and pass that value to plant_idplant ? Or if there is some better way to do this could you point me to right demo/documentation?
Thank you for your assistance, Stephanie
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top