In my page, there are 3 levels drop-down selection boxes, children are hidden until the parent is selected.
Levels
Health test organization (Level 1) -> Test Type (Level 2) -> Test Result (Level 3)
In the end of the one route, two boxes (LDI and RDI) appear in addition to the test result at level 3. The problem is; although the boxes disappear when I change level 3, those don't disappear if I change level 1 or 2.
Here are screen shots of my problem,
No selection,
Level 1 selected,
Level 2 selected,
Level 3 selected and boxes appear,
And the problem,
I just changed Health test organization (Level 1) above and the two boxes (LDI and RDI) are still there.
By the way, here is JavaScript of that part coded within the PHP script;
function options($type)
{
if($type== 'org')
{
return array('Not selected'=>'','OFA'=>'ofa','CERF'=>'cerf','CHIC'=>'chic','AHT'=>'aht','PennHip'=>'pennhip','Other'=>'other');
}
if($type== 'pass')
{
return array('Not selected'=>'','PASS'=>'1','FAIL'=>'0');
}
if($type== 'type')
{
return array('Not selected'=>'',
'Eye (CERF)' => 'eye',
'Cardiac (OFA)' => 'cardiac',
'Elbow (OFA)' => 'elbow',
'Hips (OFA)' => 'hips',
'Patellar Luxation (OFA)' => 'pl',
'Thyroid (OFA)' => 'thyroid',
'DNA (OFA)' => 'dna',
'Primary Open Angle Glaucoma (OFA)' => 'poag',
'Other (not active yet)' => 'other',
'Longevity (not active yet)' => 'longevity',
'Genotype (not active yet)' => 'genotype',
);
}
if($type== 'result')
{
}
}
function get_for_dog($id)
{
$arr[':id'] = $id;
$str = 'SELECT * FROM ' . $this->table . ' WHERE dog=:id';
if ($this->obj_debug == 1 || $this->core_debug == 1)
echo "$str<br>";
return $this->run_query($str,$arr);
}
function resultdd($test,$result)
{
$list = array();
foreach($this->testresults as $txt => $val)
{
if(strstr($val,$test.'.') ||$val =='' )
{
$list[$txt] = $val;
}
}
if(sizeof($list) > 0 && $test != '')
{
$buf = '<select name="rating">';
foreach($list as $txt =>$val)
{
$buf .= '<option value="'.$val.'" ';
if($val == $result)
$buf .= ' selected ';
$buf .= '>'.$txt.'</option>
';
}
$buf .= '</select>';
}
return $buf;
}
function customFields($i=0,$r='')
{
$buf = '';
if($this->data[$i]['rating'] =='pennhip.ldirdi' || $r =='pennhip.ldirdi')
{
$dft = array('ldi'=>'','rdi'=>'');
if($this->data[$i]['rating_data'] != '')
{
$dat = json_decode($this->data[$i]['rating_data'],true);
if(sizeof($dat) == 2)
$dat=$dat;
else
$dat = $dft;
}
else
$dat = $dft;
$buf .= 'LDI <input type="text" name="rating_data[]" value="'.$dat['ldi'].'" /><br><br>';
$buf .= ' <input type="hidden" name="rating_key[]" value="ldi" />';
$buf .= 'RDI <input type="text" name="rating_data[]" value="'.$dat['rdi'].'" /><br><br>';
$buf .= ' <input type="hidden" name="rating_key[]" value="rdi" />';
}
return $buf;
}
I'm sure there are ways to get rid of those boxes, I'd appreciate any help.