I added a validation summary on the client side. When a user doesn't enter in the names and dob the summary
appears as well as this label:
Label1.Text = "Your information was submitted"
What can I place in the code behind so the label1 will only show up when the page has been submitted successfully not when
there are errors on the page for them to fill in the required fields?
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim conn As Data.SqlClient.SqlConnection = New Data.SqlClient.SqlConnection("Data Source=cmssolutions.db.9373013.hostedresource.com; Initial Catalog=solutions; User ID=Solutions; Password=Med")
Dim cmd As New Data.SqlClient.SqlCommand
With cmd
.Connection = conn
.CommandType = Data.CommandType.StoredProcedure
.CommandText = "AddBreastCancer"
.Parameters.AddWithValue("@lName", lname.Text)
.Parameters.AddWithValue("@fName", fname.Text)
.Parameters.AddWithValue("@dob", dob.Text)
.Parameters.AddWithValue("@PatMamRbn", PatMamRbn.Text)
.Parameters.AddWithValue("@DteMamtxt", DteMamtxt.Text)
.Parameters.AddWithValue("@PatMamPrioRbn", PatMamPrioRbn.Text)
.Parameters.AddWithValue("@DteMamPriotxt", DteMamPriotxt.Text)
.Parameters.AddWithValue("@PatTimDrp", PatTmeDrp.Text)
.Parameters.AddWithValue("@CmtBox", CmtBox.Text)
End With
conn.Open()
cmd.ExecuteNonQuery()
conn.Dispose()
Label1.Text = "Your information was submitted"
End Sub
Here's the client side:
<head runat="server">
<title>Breast Cancer Screening</title>
<link rel="stylesheet" type="text/css" href="balloontip.css" />
<script type="text/javascript" src="balloontip.js">
</script>
<style type="text/css">
.style1
{
color: #FFFFFF;
font-weight: bold;
font-family:Lucida Console;
font-size:20px;
}
.style5
{
color:#000000;
font-family:Tahoma;
font-size:14px;
}
#Text1
{
width: 300px;
}
.style6
{
width: 100%;
}
.style8
{
color: #FF0000;
font-weight: bold;
}
</style>
</head>
<body onkeydown = "return (event.keyCode!=13)">
<div id="balloon1" class="balloonstyle" style="width: 350px; background-color: lightyellow">
<b>CPT - </b>77055-77057<br />
<b>HCPCS - </b>G0202, G0204, G0206<br />
<b>ICD-9-CM Procedure - </b>87.36, 87.37 0401, 0403<br />
<b>UB Revenue -</b>0401, 0403
</div>
<div id="balloon4" class="balloonstyle" style="width: 350px; background-color: lightyellow">
<b>Bilateral mastectomy</b> <br />
<b>CPT</b> - 19180, 19200, 19220, 19240, 19303-19307
WITH
Modifier 50 or modifier code 09950*<br />
<b>ICD-9-CM Procedure </b> - 85.42, 85.44, 85.46, 85.48<br /><br />
<b>Unilateral mastectomy (members must have
2 separate occurrences on 2 different dates of service)
</b><br />
<b>CPT</b> - 19180, 19200, 19220, 19240, 19303-19307<br />
<b>ICD-9-CM Procedure </b> - 85.41, 85.43, 85.45, 85.47
</div>
<div id="balloon3" class="balloonstyle" style="width: 350px; background-color: lightyellow">
<b>Description - Pregnacy</b><br />
ICD-9-CM Diagnosis- 630-679, V22, V23, V28
</div>
<div id="balloon2" class="balloonstyle" style="width: 350px; background-color: lightyellow">
<b>CPT</b> - 99201-99205, 99211-99215, 99217-99220, 99241-99245, 99341-99345, 99347-99350, 99385-99387, 99395-99397, 99401-99404, 99411, 99412, 99420, 99429, 99455, 99456
<br /><b>HCPCS</b> - G0344, 4 G0402 2
<br /><b>UB Revenue</b> - 051x, 0520-0523, 0526-0529, 0982, 0983
</div>
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<div>
<table style="width:75%;" align="center" border="1">
<tr>
<td colspan="2" align="right" valign="top">
<table class="style6">
<tr>
<td>
<a href="CMSPortal.aspx"><img align="left" src="images/back5.jpeg" border="0"/></a><asp:Label ID="Label1" runat="server" Text=""></asp:Label>
<br />
</td>
<td rowspan="2">
<img src="images/CMS%20Logo.png"
style="width: 162px; height: 90px; float: right;" /><asp:ValidationSummary
ID="ValidationSummary1" runat="server"
HeaderText="You must enter a value in the following fields:"
DisplayMode="BulletList"
EnableClientScript="true"/>
</td>
</tr>
<tr>
<td align="left" valign="bottom">
<asp:TextBox ID="Dtetxt" runat="server" Height="21px" Width="155px"></asp:TextBox>
</td>
</tr>
</table>
</td>
</tr>
<tr><td colspan = "2" bgcolor="#2A6F81" align="center" style="color: #FFFFFF"><span class="style1"> BREAST
CANCER SCREENING</span></td></tr>
<tr>
<td class="style5" bgcolor="#F2DBDB">
Last Name:
<asp:TextBox ID="lname" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ErrorMessage="Last Name" ControlToValidate="lname" Text="*"
style="font-weight: 700" Display="Dynamic" ></asp:RequiredFieldValidator>
MRID:
<asp:Label ID="Label2" runat="server" Text=""></asp:Label>
</td>
<td bgcolor="#F2DBDB" >
</td>
</tr>
<tr>
<td class="style5" bgcolor="#F2DBDB">
First Name:<asp:TextBox ID="fname" runat="server"></asp:TextBox>
<span class="style5"> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ErrorMessage="First Name" ControlToValidate="fname" Text="*"
style="font-weight: 700" Display="Dynamic" ></asp:RequiredFieldValidator></span>
Birthdate:
<asp:TextBox ID="dob" runat="server"></asp:TextBox>
<asp:Label ID="lbldoberror" runat="server"
style="display: none;" ForeColor="Red" Text="Invalid Age, maximum age is 17 years!"></asp:Label>
<asp:TextBoxWatermarkExtender ID="dob_TextBoxWatermarkExtender"
runat="server" Enabled="True" TargetControlID="dob"
WatermarkText="MM/DD/YYYY">
</asp:TextBoxWatermarkExtender>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ErrorMessage="Birthdate" ControlToValidate="dob" Text="*"
style="font-weight: 700" Display="Dynamic" ></asp:RequiredFieldValidator></td>
<td bgcolor="#F2DBDB" >
</td>
</tr>
<tr><td bgcolor="F2DBDB" valign="top" class="style5">1. Did the patient receive one or more mammogram during the measurement year?
<b><a href="#" rel="balloon1">Breast Cancer Screening</a> </b></td>
<td bgcolor="F2DBDB" valign="top" class="style5">
<asp:RadioButtonList ID="PatMamRbn" runat="server"
RepeatDirection="Horizontal" AutoPostBack="true">
<asp:ListItem Value="Y">Yes</asp:ListItem>
<asp:ListItem Value="N">No</asp:ListItem>
</asp:RadioButtonList></td></tr>
<tr><td bgcolor="F2DBDB"><span class="style5">2. Date of mammogram?</td><td bgcolor="F2DBDB" valign="top" class="style5">
<asp:TextBox ID="DteMamtxt" runat="server" style="font-family: Tahoma"></asp:TextBox> <img id="Images1" src="images/calendar.gif" style="width: 29px; height: 29px" alt="calendar"
align="bottom" /></td></tr>
<tr><td bgcolor="F2DBDB" valign="top" class="style5">3. Did the patient receive a mammogram in the year prio to the measurement year?</td><td bgcolor="F2DBDB" valign="top" class="style5">
<asp:RadioButtonList ID="PatMamPrioRbn" runat="server"
RepeatDirection="Horizontal" AutoPostBack="true">
<asp:ListItem Value="Y">Yes</asp:ListItem>
<asp:ListItem Value="N">No</asp:ListItem>
</asp:RadioButtonList></td></tr>
<tr><td bgcolor="F2DBDB" valign="top" class="style5">4. Date of mammogram in year prior?</td><td bgcolor="F2DBDB" valign="top" class="style5">
<asp:TextBox ID="DteMamPriotxt" runat="server" style="font-family: Tahoma"></asp:TextBox> <img id="Images2" src="images/calendar.gif" style="width: 29px; height: 29px" alt="calendar"
align="bottom" /></td></tr>
<tr><td bgcolor="F2DBDB" valign="top" class="style5">5. Has the patient had any of
the following at any time prior to December 31st of the measurement year?
<b><a href="#" rel="balloon4">Exclusions</a></b>
</td><td bgcolor="F2DBDB" valign="top" class="style5">
<asp:DropDownList ID="PatTmeDrp" runat="server" style="font-family: Tahoma" AutoPostback="true">
<asp:ListItem Selected="True">-Select One-</asp:ListItem>
<asp:ListItem Value="BM">Bilateral Mastecomy</asp:ListItem>
<asp:ListItem Value="UM">Unilateral Mastectomy</asp:ListItem>
<asp:ListItem Value="Unknown">Unknown</asp:ListItem>
<asp:ListItem Value="Male">Patient is Male</asp:ListItem>
</asp:DropDownList></td></tr>
<tr>
<td class="style5"colspan="2" valign="top" bgcolor="#F2DBDB">
Comments: <asp:TextBox ID="CmtBox" runat="server"
Height="166px" Width="730px"></asp:TextBox>
</td>
</tr>
<br />
</span>
<br />
<br />
<tr>
<td colspan="2" valign="top" style="text-align: center" bgcolor="#F2DBDB">
<asp:Button ID="Button1" runat="server" Text="Submit"
style="font-family: Tahoma" OnClientClick="return agecheck()"/>
<asp:Button ID="Button2" runat="server" Text="Clear"
OnClientClick="this.form.reset();return false;" style="font-family: Tahoma"/>
</td></tr>
</table>
<asp:CalendarExtender ID="CalendarExtender1" TargetControlID="DteMamtxt" PopupButtonID="Images1" runat="server">
</asp:CalendarExtender>
<asp:CalendarExtender ID="CalendarExtender2" TargetControlID="DteMamPriotxt" PopupButtonID="Images2" runat="server">
</asp:CalendarExtender>
<asp:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server" TargetControlID="DteMamtxt"
WatermarkCssClass="watermarked" WatermarkText="MM/DD/YYYY">
</asp:TextBoxWatermarkExtender>
<asp:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender2" runat="server" TargetControlID="DteMamPriotxt"
WatermarkCssClass="watermarked" WatermarkText="MM/DD/YYYY">
</asp:TextBoxWatermarkExtender>
</div>
</form>
<p class="style5" style="text-align: center">
Complete Medical Services, LLC, Patient Care Quality Assessment</p>
</body>
<script type="text/javascript" language="javascript">
function agecheck() {
var min = 42;
var max = 69;
var dt = new Date();
var maxdate = new Date("December 31, 2011");
var dob = new Date(document.getElementById('<%=dob.ClientID %>').value);
var years = maxdate.getFullYear() - dob.getFullYear();
document.getElementById('<%=lbldoberror.ClientID %>').style.display = 'none';
//check to see if less than 42 years old and more than min years old
if (years <= max && years > min) {
return true;
}
//if exactley max years old check to see if birthday month has passed
if (years == max + 1) {
if (dt.getMonth() + 1 < dob.getMonth() + 1) {
return true;
}
//if the months are equal check to see if birthday day has passed
if (dt.getMonth() + 1 == dob.getMonth() + 1) {
if (dt.getDate() < dob.getDate()) {
return true;
}
}
}
//if exactley min years old check to see if birthday month has passed
if (years == min) {
if (dt.getMonth() + 1 < dob.getMonth() + 1) {
return true;
}
//if the months are equal check to see if birthday day has passed
if (dt.getMonth() + 1 == dob.getMonth() + 1) {
if (dt.getDate() > dob.getDate()) {
return true;
}
}
}
if (confirm("The birth date entered is outside the age range. Do you still want to submit this form?")) {
return true;
}
document.getElementById('<%=lbldoberror.ClientID %>').style.display = 'inline';
return false;
}
</script>
</html>