Hello,
I am using cascading select logic I found elsewhere in the forum (see below) and it works great for new records, but not for existing records. When I pull up an existing record the select box for regions and localities shows ALL regions and ALL localities. Is there a way to trigger the onclick code automatically as part of the page load process? In the meantime I added onfocus event code (below), but it causes the blanking of the previously selected values:
<?
class tables_localities {
function block__after_new_record_form(){
echo <<<END
<script><var>getQuery();
$table =& Dataface_Table::loadTable($query['-table']);
$regions = $table->getValuelist('Region');
$region_countries = $table->getValuelist('Region__meta');
$localities = $table->getValuelist('Locality');
$locality_regions = $table->getValuelist('Locality__meta');
import('Services/JSON.php');
$json =& new Services_JSON();
echo '
var regions_options = '.$json->encode($regions).';
var regions_country = '.$json->encode($region_countries).';
var localities_options = '.$json->encode($localities).';
var localities_region = '.$json->encode($locality_regions).';
';
echo <<<END></script>
END;
}
function block__after_edit_record_form(){
return $this->block__after_new_record_form();
}
}
?>