I am attempting to add a select field and have it display the current state when editing. Current the function correctly stores the state and gives the option to select among the fifty. But when I choose edit contact the state field defaults to the "Select" . What do I do to get this field to current state value.
I am attempting to add a select field and have it display the current state when editing. Current the function correctly stores the state and gives the option to select among the fifty. But when I choose edit contact the state field defaults to the "Select" . What do I do to get this field to current state value.
The code follows.
$this->states = array("Select State","Alabama", Arizona","Arkansas",..);
if(empty($this->_company_state))
$this->_company_state = $this->states;
else $this->_company_state = $this->_company_state;
$form->add("Contact_company_state", "select", $this->_company_state);
$form->setValue("Contact_company_state", $this->states);
$form->reindexValue("Contact_company_state");
$form->setMatch("Contact_company_state", array($states));
$form->setTab("Contact_company_state", $tabs);
$tabs++;