i got a little bit of problem with my script for php page that I'm creating. I want to assign a case with multiple practice areas which will correspond with several subpractice_areas.
I want the page to show the subpractice areas for the practice areas selected. However it is not doing anything. It did print "I'm in" but it didn't give me the subpractice areas.
Is my javascript right ? I'm new to javascript and need lots of pointers from experts.
here is my code
<script language="JavaScript" type="text/javascript">
function selectSubPrac()
{
var oForm = document.form1;
if (oForm.case_practicearea.value > 0)
{
document.write("I'm in");
oForm.isSubmitAction.value="selectSubpractice";
oForm.submit();
}
}
</script>
while ( list($practiceid, $practicename) = mysql_fetch_array($sql) )
{
echo "test";
db_connect();
$sql_2 = @mysql_query("SELECT subpractice_id, subpractice_name
FROM subpractice_area
WHERE subpractice_id = '" . $practice_id . "' ");
$javascript_block = 'javascript_block_' . $practiceid ;
$javascript_block .= '<select name="case_subpracticearea" multiple = "yes" >';
while (list ($subpracid, $subpracname) = @mysql_fetch_array($sql_2))
{
echo "subpracid = " . $subpracid;
$javascript_block .= '<option value="'.$subpracid.'>'.$subpracname.'</option>';
}
$javascript_block .= '</select>';
// populating the display block
$display_block .= "\n<tr>"
."\n<td>
\n\t<INPUT type=\"checkbox\" name=\" case_practicearea \" value=\" " . $practiceid . " \" onClick=\"selectSubPrac();\"> " . $practicename
."\n</td>";
if ($_POST[isSubmitAction] == "selectSubpractice")
{
echo "test submit";
$display_block .= "\n" . '<td>' . $javascript_block . '</td>';
}
$display_block .= "</tr>";
}
Thanks
joey
I want the page to show the subpractice areas for the practice areas selected. However it is not doing anything. It did print "I'm in" but it didn't give me the subpractice areas.
Is my javascript right ? I'm new to javascript and need lots of pointers from experts.
here is my code
<script language="JavaScript" type="text/javascript">
function selectSubPrac()
{
var oForm = document.form1;
if (oForm.case_practicearea.value > 0)
{
document.write("I'm in");
oForm.isSubmitAction.value="selectSubpractice";
oForm.submit();
}
}
</script>
while ( list($practiceid, $practicename) = mysql_fetch_array($sql) )
{
echo "test";
db_connect();
$sql_2 = @mysql_query("SELECT subpractice_id, subpractice_name
FROM subpractice_area
WHERE subpractice_id = '" . $practice_id . "' ");
$javascript_block = 'javascript_block_' . $practiceid ;
$javascript_block .= '<select name="case_subpracticearea" multiple = "yes" >';
while (list ($subpracid, $subpracname) = @mysql_fetch_array($sql_2))
{
echo "subpracid = " . $subpracid;
$javascript_block .= '<option value="'.$subpracid.'>'.$subpracname.'</option>';
}
$javascript_block .= '</select>';
// populating the display block
$display_block .= "\n<tr>"
."\n<td>
\n\t<INPUT type=\"checkbox\" name=\" case_practicearea \" value=\" " . $practiceid . " \" onClick=\"selectSubPrac();\"> " . $practicename
."\n</td>";
if ($_POST[isSubmitAction] == "selectSubpractice")
{
echo "test submit";
$display_block .= "\n" . '<td>' . $javascript_block . '</td>';
}
$display_block .= "</tr>";
}
Thanks
joey