Running Bear
04-17-2003, 05:18 PM
Hi,
I'm trying to design a form which is to be used to define and manage the permissions on my site. When a user checks/unchecks a check box labeled Visible I want to enable/disable the other options relating to that particular page. This all works perfectly until a user fiddles around with the form then clicks reset, at this point the original values are reapplied but all options that were enabled and or disabled are not reset.
Therefore I ideally want to trap the onReset event - which I don't think exists in each visible control and reapply the enable/disable
Does anyone have any ideas on how to get round this?
Any help or ideas will be greatly appreciated
Cheers Al :D
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
// Disable/Enable check box row for the corresponding form
function toggleCBRow(frmNo) {
if (document.all || document.getElementById) {
if (document.getElementById('Is_Visible_'+frmNo).checked) {
document.getElementById('Is_Add_'+frmNo).disabled = false;
document.getElementById('Is_Edit_'+frmNo).disabled = false;
document.getElementById('Is_Delete_'+frmNo).disabled = false;
}else{
document.getElementById('Is_Add_'+frmNo).disabled = true;
document.getElementById('Is_Edit_'+frmNo).disabled = true;
document.getElementById('Is_Delete_'+frmNo).disabled = true;
}
}
}
// End -->
</script>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<table>
<form>
<tr>
<th> Form Name </th>
<th> Visible </th>
<th> Add </th>
<th> Edit </th>
<th> Delete </th>
</tr>
<tr>
<td align=right bgcolor="#F7F7F7" width="200"> Division:</td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Visible_1' id='Is_visible_1' Checked onClick="return toggleCBRow(1);"> </td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Add_1' id='Is_Add_1' > </td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Edit_1' id='Is_Edit_1' > </td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Delete_1' id='Is_Delete_1'> </td>
</tr>
<tr>
<td align=right bgcolor="#F7F7F7" width="200"> Quarterly Status:</td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Visible_2' id='Is_visible_2' Checked onClick="return toggleCBRow(2);"> </td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Add_2'id='Is_Add_2'> </td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Edit_2'id='Is_Edit_2'> </td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Delete_2'id='Is_Delete_2'> </td>
</tr>
<tr>
<td align=right bgcolor="#F7F7F7" width="200"> Key Business Process:</td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Visible_3' id='Is_visible_3' onClick="return toggleCBRow(3);"> </td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Add_3'id='Is_Add_3' Disabled> </td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Edit_3'id='Is_Edit_3' Disabled> </td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Delete_3'id='Is_Delete_3' Disabled> </td>
</tr>
<tr>
<td bgcolor="#F7F7F7" colspan="5"> </td>
</tr>
<tr>
<td align=center bgcolor="#F7F7F7" colspan="2"><input type=submit name='mySubmit' id='mySubmit'> </td>
<td align=center bgcolor="#F7F7F7" colspan="3"><input type=Reset name='myReSet' id='myReSet'> </td>
</tr>
</form>
</table>
</BODY>
</HTML>
I'm trying to design a form which is to be used to define and manage the permissions on my site. When a user checks/unchecks a check box labeled Visible I want to enable/disable the other options relating to that particular page. This all works perfectly until a user fiddles around with the form then clicks reset, at this point the original values are reapplied but all options that were enabled and or disabled are not reset.
Therefore I ideally want to trap the onReset event - which I don't think exists in each visible control and reapply the enable/disable
Does anyone have any ideas on how to get round this?
Any help or ideas will be greatly appreciated
Cheers Al :D
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
// Disable/Enable check box row for the corresponding form
function toggleCBRow(frmNo) {
if (document.all || document.getElementById) {
if (document.getElementById('Is_Visible_'+frmNo).checked) {
document.getElementById('Is_Add_'+frmNo).disabled = false;
document.getElementById('Is_Edit_'+frmNo).disabled = false;
document.getElementById('Is_Delete_'+frmNo).disabled = false;
}else{
document.getElementById('Is_Add_'+frmNo).disabled = true;
document.getElementById('Is_Edit_'+frmNo).disabled = true;
document.getElementById('Is_Delete_'+frmNo).disabled = true;
}
}
}
// End -->
</script>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<table>
<form>
<tr>
<th> Form Name </th>
<th> Visible </th>
<th> Add </th>
<th> Edit </th>
<th> Delete </th>
</tr>
<tr>
<td align=right bgcolor="#F7F7F7" width="200"> Division:</td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Visible_1' id='Is_visible_1' Checked onClick="return toggleCBRow(1);"> </td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Add_1' id='Is_Add_1' > </td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Edit_1' id='Is_Edit_1' > </td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Delete_1' id='Is_Delete_1'> </td>
</tr>
<tr>
<td align=right bgcolor="#F7F7F7" width="200"> Quarterly Status:</td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Visible_2' id='Is_visible_2' Checked onClick="return toggleCBRow(2);"> </td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Add_2'id='Is_Add_2'> </td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Edit_2'id='Is_Edit_2'> </td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Delete_2'id='Is_Delete_2'> </td>
</tr>
<tr>
<td align=right bgcolor="#F7F7F7" width="200"> Key Business Process:</td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Visible_3' id='Is_visible_3' onClick="return toggleCBRow(3);"> </td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Add_3'id='Is_Add_3' Disabled> </td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Edit_3'id='Is_Edit_3' Disabled> </td>
<td align=center bgcolor="#F7F7F7" width="100"><input type=checkbox name='Is_Delete_3'id='Is_Delete_3' Disabled> </td>
</tr>
<tr>
<td bgcolor="#F7F7F7" colspan="5"> </td>
</tr>
<tr>
<td align=center bgcolor="#F7F7F7" colspan="2"><input type=submit name='mySubmit' id='mySubmit'> </td>
<td align=center bgcolor="#F7F7F7" colspan="3"><input type=Reset name='myReSet' id='myReSet'> </td>
</tr>
</form>
</table>
</BODY>
</HTML>