Remove Physical Exams textboxes

Hi team, i have succeeded in implementing a conditional function on the checkboxes of the physical exams which will only display the sub checkboxes when the status is Abnormal. But now i want to remove each some texboxes on the form thereby leaving the corresponding text


And this is what i want to achieve

@Avse_Informatica @Param_CapMinds @luisuriarte please help

Hi Natt SL Limited,
1.Just change the code(line number 37 and 42) on
interface\forms\physical_exam\new.php file

function showExamLine($line_id, $description, &$linedbrow, $sysnamedisp)
{
$dres = sqlStatement(“SELECT * FROM form_physical_exam_diagnoses " .
“WHERE line_id = ? ORDER BY ordering, diagnosis”, array($line_id));
echo " \n”;
echo " <input type=‘checkbox’ name=‘form_obs[" . attr($line_id) . "][wnl]’ " .
“value=‘1’” . ($linedbrow[‘wnl’] ? " checked" : “”) . " />\n";
echo " <input type=‘checkbox’ class=‘abn’ id=".$line_id." name=‘form_obs[" . attr($line_id) . "][abn]’ " .
“value=‘1’” . ($linedbrow[‘abn’] ? " checked" : “”) . " />\n";
echo " " . text($sysnamedisp) . “\n”;
echo " " . text($description) . “\n”;
echo " \n";
echo " \n";
$diagnosis = $linedbrow[‘diagnosis’];
while ($drow = sqlFetchArray($dres)) {
$sel = ‘’;
$diag = $drow[‘diagnosis’];
if ($diagnosis && $diag == $diagnosis) {
$sel = ‘selected’;
$diagnosis = ‘’;
}
echo " <option value=’" . attr($diag) . “’ $sel>” . text($diag) . “\n”;
}
if ($diagnosis) {
echo " (" . text($diagnosis) . “)\n”;
}
echo " – Edit –\n";
echo " \n";
echo " <input type=‘text’ name=‘form_obs[" . attr($line_id) . "][comments]’ " .
“size=‘20’ maxlength=‘250’ style=‘width:100%’ " .
“value=’” . attr($linedbrow[‘comments’]) . “’ />\n”;
echo " \n”;
}

2.Then add script end of the line

$(function(){
    $('.abn').each(function(){
        var id=$(this).attr('id');
        var val=$(this).parent().closest("td").next().text();
        if(val!='')
        {
            if($("#"+id).is(":checked"))
            {
            $("#form_obs_"+id).hide();
            }else{
                $("#form_obs_"+id).show(); } }
       
    })
    $('.abn').click(function(){
        var id=$(this).attr('id');
        var val=$(this).parent().closest("td").next().text();
        if(val!='')
        {    if($("#"+id).is(":checked"))
            { $("#form_obs_"+id).hide();}
            else{
                $("#form_obs_"+id).show();
            }
        }
    })
})

Output:

Thanks,
Param
help@capminds.com

@Param_CapMinds thanks for the reply, but do u mean i should copy or do the changes as your code.
please see my code on the so i can know what to change, thanks

No need to copy just change line no 46 and 52

1 Like

@Param_CapMinds Thanks very much for your effort, i still cant get it. It will be of good if you can send me your new.php file.
I made some hide and show in the original file please see where i made the changes.