The problem:
In one page I click a click to either safety or environment. Depending on the choice it loads the next page differently. The safety one has a bunch of checkboxes that have to be checked to classify an incident. On environment these boxes don't appear.
I got this part working 100%. Now the problem comes in when trying to save the data.
Here is the html
Code: Select all
<div id="Show" runat="server" style="display: block;">
<table class="block1">
<tbody>
<tr id="ViewRC1" vAlign="top">
<td class="content1" style="WIDTH: 17.04%"><FONT color="red">* </FONT>Criteria<br>
(Select a Consequence and Likelihood to populate the result.)</td>
<td colSpan="5">
<table class="block1" width="100%">
<tr>
<td class="content1" style="HEIGHT: 20px">Consequence</td>
<td class="content3" style="WIDTH: 109px; HEIGHT: 20px"><asp:dropdownlist id="lstProbability" runat="server" onChange="getSevResult();">
<asp:ListItem Value="-- Not Selected --">-- Not Selected --</asp:ListItem>
<asp:ListItem Value="low">Low</asp:ListItem>
<asp:ListItem Value="medium">Medium</asp:ListItem>
<asp:ListItem Value="high">High</asp:ListItem>
</asp:dropdownlist></td>
<td class="content1" style="HEIGHT: 20px">Likelihood </td>
<td class="content3" style="WIDTH: 110px; HEIGHT: 20px"><asp:dropdownlist id="lstFrequency" runat="server" onChange="getSevResult();">
<asp:ListItem Value="-- Not Selected --">-- Not Selected --</asp:ListItem>
<asp:ListItem Value="low">Low</asp:ListItem>
<asp:ListItem Value="medium">Medium</asp:ListItem>
<asp:ListItem Value="high">High</asp:ListItem>
</asp:dropdownlist></td>
<td class="content1" style="WIDTH: 11.73%; HEIGHT: 20px">Result</td>
<td class="content3" style="HEIGHT: 20px"><asp:textbox id="sevResult" CssClass="read" ReadOnly="True" Runat="server"></asp:textbox></td>
</tr>
<tr>
<td class="content1"><A class="myStandard" onclick="SeverityDef()" href="javascript: ;"><span style="COLOR: red">*</span>
Severity Rating</A></td>
<td class="content3" style="WIDTH: 318px" colSpan="3"><asp:dropdownlist id="lstSeverity" runat="server" Width="312px">
<asp:ListItem Value="-- Not Selected --">-- Not Selected --</asp:ListItem>
<asp:ListItem Value="Level 1">Level 1 (Local & Internally Reportable)</asp:ListItem>
<asp:ListItem Value="Level 2">Level 2 (Legal & Financial Implications)</asp:ListItem>
<asp:ListItem Value="Level 3 (Geographic Reputation & Significant Financial)">Level 3 (Geographic Reputation & Significant Financial)</asp:ListItem>
</asp:dropdownlist></td>
<td class="content1" style="WIDTH: 11.73%"><span style="COLOR: red">*</span> Type</td>
<td class="content3"><asp:dropdownlist id="lstType" runat="server">
<asp:ListItem Value="-- Not Selected --">-- Not Selected --</asp:ListItem>
<asp:ListItem Value="INC">Incident</asp:ListItem>
<asp:ListItem Value="COM">Complaint</asp:ListItem>
<asp:ListItem Value="Compliment">Compliment</asp:ListItem>
<asp:ListItem Value="NC">Non-Conformance</asp:ListItem>
<asp:ListItem Value="Internal Audit">Internal Audit</asp:ListItem>
<asp:ListItem Value="External Audit">External Audit</asp:ListItem>
</asp:dropdownlist></td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</TD></TR></TBODY></TBODY>
<div id="Hide" runat="server">
<table class="block1">
<tbody>
<TR id="safety" style="DISPLAY: none" vAlign="top">
<td class="content1" style="WIDTH: 31.38%"><A class="myStandard" onclick="SHCD()" href="javascript: ;"><span style="COLOR: red">
+ Click To Expand/Collapse</span></A>
</td>
<td class="title" colSpan="5"><span style="FONT-WEIGHT: bold; FONT-SIZE: 13px"> INCIDENT
CLASSIFICATION DETAILS</span>
</td>
</TR>
<tr id="SHCD" style="DISPLAY: none" vAlign="top">
<td class="content1" style="WIDTH: 31.38%; HEIGHT: 32px">Incident Classification /
Consequence</td>
<td class="content3" style="HEIGHT: 32px" colSpan="5"><span style="COLOR: red">Please
select applicable Incident Classification / Consequence</span><br>
<asp:checkbox id="chkCloseCall" Runat="server" Text="Close Call"></asp:checkbox>
<asp:checkbox id="chkHPI" Runat="server" Text="HPI"></asp:checkbox>
<asp:checkbox id="chkInjury" Runat="server" Text="Injury"></asp:checkbox>
<asp:checkbox id="chkNonComp" Runat="server" Text="Non-Compliance"></asp:checkbox>
<asp:checkbox id="chkPropDamage" Runat="server" Text="Property Damage"></asp:checkbox></td>
</tr>
</tbody>
</table>
</div>
I need to get it two check these two data depending on the visible state of the div. I got most of the function but the if part does not work. Here is the javaScript for it:
Code: Select all
if (document.Form1.safety.style.display = "block")
{
document.Form1.txtAction.value = "Check"
alert("Please classify the incident.")
document.all.SHCD.style.display = "block"
canSubmit = false
}
else {
if (document.Form1.safety.style.display == ""){
if (document.Form1.lstSeverity.selectedIndex == 0 && canSubmit){
alert("Please select a Severity.")
document.all.ViewRC1.style.display = "block"
canSubmit = false
document.Form1.lstSeverity.focus()
}
}
}
function safety() {
document.all.safety.style.display == "none" ? document.all.ViewEnv1.style.display = "block" : document.all.safety.style.display = "none";
}
When I run it i get the "document.all.safety.style.display == "none"" can't be null or is not an object.