noor21
asked on
i want an alarm message when two field exceed this value
Hi,
i have the following for :
date:
station name:
inflow target:
outflow target:
inflow actual:
change of storage:
outflow actual:
and i have a bit of complicated issue,that when a user enters the inflow actual and change of storage,they should satisfy the following equation:
inflow actual - (change of storage) =~ outflow ctual
(=~ means the value of the right hand side should be equal or different by 2.5% from the left hand side)
i want the user when entering those values ,if they are more than the specified criteria,it gives a warning pop up message saying(your value exceeds the agreed range,do you want to continue)then yes or no buttons in order to fill the remaining fields of the form and press confirm to save them.
is that possible???
i have the following for :
date:
station name:
inflow target:
outflow target:
inflow actual:
change of storage:
outflow actual:
and i have a bit of complicated issue,that when a user enters the inflow actual and change of storage,they should satisfy the following equation:
inflow actual - (change of storage) =~ outflow ctual
(=~ means the value of the right hand side should be equal or different by 2.5% from the left hand side)
i want the user when entering those values ,if they are more than the specified criteria,it gives a warning pop up message saying(your value exceeds the agreed range,do you want to continue)then yes or no buttons in order to fill the remaining fields of the form and press confirm to save them.
is that possible???
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Look, web applications composed of client side coding and server side coding. Client side means code that executes on visitors browser..e.g. hide and show certain fields when user selects particular country. Its mainly used to give immediate response to user's action. They are called client side scripts - mainly written in JavaScript or Jscript. You can go for Vbscript which only runs in Internet Explorer.All browsers recognize Javascript, so I have given you code snippet in the same..
Other is server side, which you can write in your favourite language that .NET supports...In server side scripts you do some backend processing, maintain user sessions, control display of form..
Taking your specific use, its good to go for client side script(I've written in javascript), as we want to show immediate response when user enters value beyond certain criteria.
Regards.
MaulikCE
Other is server side, which you can write in your favourite language that .NET supports...In server side scripts you do some backend processing, maintain user sessions, control display of form..
Taking your specific use, its good to go for client side script(I've written in javascript), as we want to show immediate response when user enters value beyond certain criteria.
Regards.
MaulikCE
cld u post the aspx code .. so as to see what ur controls are named as .. it would help to give u the exact code ...
ASKER
i have the form.aspx page that has the form and submit button that opens a pop up window that has the values of the form to be confirmed by the user:
form.aspx:
-------------
<script language="javascript">
function OpenNewWindow()
{
window.open('pumping_confi rm.aspx', '', 'menu=no,location=no,statu s=no');
}
</script>
while in the pop up window this is the code:
-------------------------- ---------- ---------- ----------
Try
Dim MySQL As String = "Insert into pumping_station_operation_ data([date ],station_ id,inflow_ target,out flow_targe t,inflow_a ctual,outf low_actual ,storage,c hange_of_s torage_tar get,change _of_storag e) values (@txttext1,@texttest2,@txt test3,@txt test4,@txt test5,@txt test6,@txt test7,@txt test8,@txt test9)"
Dim myConn As SqlConnection = New SqlConnection("*********** *******")
Dim Cmd As New SqlCommand(MySQL, myConn)
Cmd.Parameters.Add(New SqlParameter("@txttext1", TextBox1.Text))
Cmd.Parameters.Add(New SqlParameter("@texttest2", TextBox2.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest3", TextBox3.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest4", TextBox4.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest5", TextBox5.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest6", TextBox6.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest7", TextBox7.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest8", TextBox8.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest9", TextBox9.Text))
Label1.Text = "Your Data Is Saved"
myConn.Open()
Cmd.ExecuteNonQuery()
Catch ex As SqlClient.SqlException
Dim lstrScript As String
lstrScript += "<Script language = javascript>alert('You Have Entered Duplicate Date!');</Script>"
Page.RegisterClientScriptB lock("Erro OnPage", lstrScript)
End Try
BindData()
Sub BindData()
Dim myConn As SqlConnection = New SqlConnection("*********** ******8")
Dim MySQL As String
MySQL = "Select * from pumping_station_operation_ data "
Dim Cmd1 As New SqlCommand(MySQL, myConn)
Dim ds As DataSet = New DataSet
Dim Cmd As New SqlDataAdapter(MySQL, myConn)
Cmd.Fill(ds, "pump_operation_data")
mydatagrid.DataSource = ds.Tables("pump_operation_ data").Def aultView
mydatagrid.DataBind()
End Sub
form.aspx:
-------------
<script language="javascript">
function OpenNewWindow()
{
window.open('pumping_confi
}
</script>
while in the pop up window this is the code:
--------------------------
Try
Dim MySQL As String = "Insert into pumping_station_operation_
Dim myConn As SqlConnection = New SqlConnection("***********
Dim Cmd As New SqlCommand(MySQL, myConn)
Cmd.Parameters.Add(New SqlParameter("@txttext1", TextBox1.Text))
Cmd.Parameters.Add(New SqlParameter("@texttest2",
Cmd.Parameters.Add(New SqlParameter("@txttest3", TextBox3.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest4", TextBox4.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest5", TextBox5.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest6", TextBox6.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest7", TextBox7.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest8", TextBox8.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest9", TextBox9.Text))
Label1.Text = "Your Data Is Saved"
myConn.Open()
Cmd.ExecuteNonQuery()
Catch ex As SqlClient.SqlException
Dim lstrScript As String
lstrScript += "<Script language = javascript>alert('You Have Entered Duplicate Date!');</Script>"
Page.RegisterClientScriptB
End Try
BindData()
Sub BindData()
Dim myConn As SqlConnection = New SqlConnection("***********
Dim MySQL As String
MySQL = "Select * from pumping_station_operation_
Dim Cmd1 As New SqlCommand(MySQL, myConn)
Dim ds As DataSet = New DataSet
Dim Cmd As New SqlDataAdapter(MySQL, myConn)
Cmd.Fill(ds, "pump_operation_data")
mydatagrid.DataSource = ds.Tables("pump_operation_
mydatagrid.DataBind()
End Sub
i asked for the aspx code of the page where u want the validation ...
ASKER
thats it Rejojohny:
Try
Dim MySQL As String = "Insert into pumping_station_operation_ data([date ],station_ id,inflow_ target,out flow_targe t,inflow_a ctual,outf low_actual ,storage,c hange_of_s torage_tar get,change _of_storag e) values (@txttext1,@texttest2,@txt test3,@txt test4,@txt test5,@txt test6,@txt test7,@txt test8,@txt test9)"
Dim myConn As SqlConnection = New SqlConnection("*********** *******")
Dim Cmd As New SqlCommand(MySQL, myConn)
Cmd.Parameters.Add(New SqlParameter("@txttext1", TextBox1.Text))
Cmd.Parameters.Add(New SqlParameter("@texttest2", TextBox2.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest3", TextBox3.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest4", TextBox4.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest5", TextBox5.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest6", TextBox6.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest7", TextBox7.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest8", TextBox8.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest9", TextBox9.Text))
Label1.Text = "Your Data Is Saved"
myConn.Open()
Cmd.ExecuteNonQuery()
Catch ex As SqlClient.SqlException
Dim lstrScript As String
lstrScript += "<Script language = javascript>alert('You Have Entered Duplicate Date!');</Script>"
Page.RegisterClientScriptB lock("Erro OnPage", lstrScript)
End Try
BindData()
Sub BindData()
Dim myConn As SqlConnection = New SqlConnection("*********** ******8")
Dim MySQL As String
MySQL = "Select * from pumping_station_operation_ data "
Dim Cmd1 As New SqlCommand(MySQL, myConn)
Dim ds As DataSet = New DataSet
Dim Cmd As New SqlDataAdapter(MySQL, myConn)
Cmd.Fill(ds, "pump_operation_data")
mydatagrid.DataSource = ds.Tables("pump_operation_ data").Def aultView
mydatagrid.DataBind()
End Sub
Try
Dim MySQL As String = "Insert into pumping_station_operation_
Dim myConn As SqlConnection = New SqlConnection("***********
Dim Cmd As New SqlCommand(MySQL, myConn)
Cmd.Parameters.Add(New SqlParameter("@txttext1", TextBox1.Text))
Cmd.Parameters.Add(New SqlParameter("@texttest2",
Cmd.Parameters.Add(New SqlParameter("@txttest3", TextBox3.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest4", TextBox4.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest5", TextBox5.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest6", TextBox6.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest7", TextBox7.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest8", TextBox8.Text))
Cmd.Parameters.Add(New SqlParameter("@txttest9", TextBox9.Text))
Label1.Text = "Your Data Is Saved"
myConn.Open()
Cmd.ExecuteNonQuery()
Catch ex As SqlClient.SqlException
Dim lstrScript As String
lstrScript += "<Script language = javascript>alert('You Have Entered Duplicate Date!');</Script>"
Page.RegisterClientScriptB
End Try
BindData()
Sub BindData()
Dim myConn As SqlConnection = New SqlConnection("***********
Dim MySQL As String
MySQL = "Select * from pumping_station_operation_
Dim Cmd1 As New SqlCommand(MySQL, myConn)
Dim ds As DataSet = New DataSet
Dim Cmd As New SqlDataAdapter(MySQL, myConn)
Cmd.Fill(ds, "pump_operation_data")
mydatagrid.DataSource = ds.Tables("pump_operation_
mydatagrid.DataBind()
End Sub
i mean the script .. the HTML (ASPX) page .. the tags .. <asp:textbox> etc ....
ASKER
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm4.aspx. vb" Inherits="water_control.We bForm4"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>generation station operation data</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScri pt">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<script language="javascript">
function OpenNewWindow()
{
window.open('WebForm5.aspx ', '', 'menu=no,location=no,statu s=no');
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout " background="file:///C:/Doc uments%20a nd%20Setti ngs/Deskto p/design/w cc_pic/New %20Image1. JPG">
<form id="Form1" method="post" runat="server">
<TABLE id="Table1" style="Z-INDEX: 101; LEFT: 176px; WIDTH: 360px; POSITION: absolute; TOP: 256px; HEIGHT: 384px"
cellSpacing="1" cellPadding="1" width="360" border="1">
<TR>
<TD style="WIDTH: 206px; HEIGHT: 31px"><STRONG>Date:</STRON G></TD>
<TD style="HEIGHT: 31px"><asp:textbox id="TextBox1" runat="server"></asp:textb ox></TD>
</TR>
<TR>
<TD style="WIDTH: 206px"><STRONG>Station Name:</STRONG></TD>
<TD><asp:dropdownlist id="ddlcustomer" runat="server" Width="120px"></asp:dropdo wnlist></T D>
</TR>
<TR>
<TD style="WIDTH: 206px"><STRONG>Production: </STRONG>< /TD>
<TD><asp:textbox id="TextBox3" runat="server"></asp:textb ox></TD>
</TR>
<TR>
<TD style="WIDTH: 206px"><STRONG>Outflow:</S TRONG></TD >
<TD><asp:textbox id="TextBox4" runat="server"></asp:textb ox></TD>
</TR>
<TR>
<TD style="WIDTH: 206px"><STRONG>Storage:</S TRONG></TD >
<TD><asp:textbox id="TextBox5" runat="server"></asp:textb ox></TD>
</TR>
<TR>
<TD style="WIDTH: 206px"><STRONG>Internal Consumption:</STRONG></TD>
<TD><asp:textbox id="TextBox6" runat="server"></asp:textb ox></TD>
</TR>
<TR>
<TD style="WIDTH: 206px"><STRONG>Total MGD:</STRONG></TD>
<TD><asp:textbox id="TextBox7" runat="server"></asp:textb ox></TD>
</TR>
<TR>
<TD style="WIDTH: 206px"><STRONG>Production Target:</STRONG></TD>
<TD><asp:textbox id="TextBox8" runat="server"></asp:textb ox></TD>
</TR>
<TR>
<TD style="WIDTH: 206px"><STRONG>Change Of Storage Target:</STRONG></TD>
<TD><asp:textbox id="TextBox9" runat="server"></asp:textb ox></TD>
</TR>
<TR>
<TD style="WIDTH: 206px"><STRONG>Change Of Storage:</STRONG></TD>
<TD><asp:textbox id="TextBox10" runat="server"></asp:textb ox></TD>
</TR>
<TR>
<TD style="WIDTH: 206px"><INPUT style="WIDTH: 72px; HEIGHT: 24px" onclick="javascript:OpenNe wWindow(); " type="button"
value="Submit">
<asp:button id="Button1" runat="server" Width="64px" Text="Clear"></asp:button> </TD>
<TD></TD>
</TR>
</TABLE>
<asp:label id="Label1" style="Z-INDEX: 102; LEFT: 48px; POSITION: absolute; TOP: 216px" runat="server"></asp:label ><asp:labe l id="Label2" style="Z-INDEX: 103; LEFT: 224px; POSITION: absolute; TOP: 216px" runat="server"></asp:label >
<HR style="Z-INDEX: 104; LEFT: 16px; POSITION: absolute; TOP: 208px" width="100%" SIZE="1">
<HR style="Z-INDEX: 105; LEFT: 16px; POSITION: absolute; TOP: 240px" width="100%" SIZE="1">
<asp:HyperLink id="HyperLink6" style="Z-INDEX: 107; LEFT: 408px; POSITION: absolute; TOP: 656px"
runat="server" NavigateUrl="view_generati on.aspx">C lick Here</asp:HyperLink>
<asp:HyperLink id="HyperLink7" style="Z-INDEX: 108; LEFT: 16px; POSITION: absolute; TOP: 160px"
runat="server" NavigateUrl="disti.aspx" ImageUrl="file:///C:\Docum ents and Settings\Desktop\design\wc c_pic\butt on3D.jpg"> HyperLink< /asp:Hyper Link>
<asp:HyperLink id="HyperLink8" style="Z-INDEX: 109; LEFT: 144px; POSITION: absolute; TOP: 160px"
runat="server" NavigateUrl="line.aspx" ImageUrl="file:///C:\Docum ents and Settings\Desktop\design\wc c_pic\butt on40.jpg"> HyperLink< /asp:Hyper Link>
<asp:HyperLink id="HyperLink9" style="Z-INDEX: 110; LEFT: 272px; POSITION: absolute; TOP: 160px"
runat="server" NavigateUrl="tanks.aspx" ImageUrl="file:///C:\Docum ents and Settings\Desktop\design\wc c_pic\butt on43.jpg"> HyperLink< /asp:Hyper Link>
<asp:HyperLink id="HyperLink10" style="Z-INDEX: 111; LEFT: 400px; POSITION: absolute; TOP: 160px"
runat="server" NavigateUrl="first.aspx" ImageUrl="file:///C:\Docum ents and Settings\Desktop\design\wc c_pic\butt on46.jpg"> HyperLink< /asp:Hyper Link>
<asp:HyperLink id="HyperLink11" style="Z-INDEX: 112; LEFT: 528px; POSITION: absolute; TOP: 160px"
runat="server" NavigateUrl="logout.aspx" ImageUrl="file:///C:\Docum ents and Settings\Desktop\design\wc c_pic\butt on22.jpg"> HyperLink< /asp:Hyper Link><IMG style="Z-INDEX: 113; LEFT: 24px; POSITION: absolute; TOP: 16px" alt="" src="file:///C:\Documents and Settings\Desktop\design\wc c_pic\UNTI TLED-21 copy.gif">
<HR style="Z-INDEX: 114; LEFT: 16px; POSITION: absolute; TOP: 152px" width="100%" SIZE="1">
<asp:Label id="Label3" style="Z-INDEX: 106; LEFT: 72px; POSITION: absolute; TOP: 656px" runat="server"
Width="328px" Font-Bold="True" Font-Size="Small">To View The Generation Station Operation Data</asp:Label>
</form>
<br>
<br>
<br>
</body>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>generation station operation data</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScri
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<script language="javascript">
function OpenNewWindow()
{
window.open('WebForm5.aspx
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout
<form id="Form1" method="post" runat="server">
<TABLE id="Table1" style="Z-INDEX: 101; LEFT: 176px; WIDTH: 360px; POSITION: absolute; TOP: 256px; HEIGHT: 384px"
cellSpacing="1" cellPadding="1" width="360" border="1">
<TR>
<TD style="WIDTH: 206px; HEIGHT: 31px"><STRONG>Date:</STRON
<TD style="HEIGHT: 31px"><asp:textbox id="TextBox1" runat="server"></asp:textb
</TR>
<TR>
<TD style="WIDTH: 206px"><STRONG>Station Name:</STRONG></TD>
<TD><asp:dropdownlist id="ddlcustomer" runat="server" Width="120px"></asp:dropdo
</TR>
<TR>
<TD style="WIDTH: 206px"><STRONG>Production:
<TD><asp:textbox id="TextBox3" runat="server"></asp:textb
</TR>
<TR>
<TD style="WIDTH: 206px"><STRONG>Outflow:</S
<TD><asp:textbox id="TextBox4" runat="server"></asp:textb
</TR>
<TR>
<TD style="WIDTH: 206px"><STRONG>Storage:</S
<TD><asp:textbox id="TextBox5" runat="server"></asp:textb
</TR>
<TR>
<TD style="WIDTH: 206px"><STRONG>Internal Consumption:</STRONG></TD>
<TD><asp:textbox id="TextBox6" runat="server"></asp:textb
</TR>
<TR>
<TD style="WIDTH: 206px"><STRONG>Total MGD:</STRONG></TD>
<TD><asp:textbox id="TextBox7" runat="server"></asp:textb
</TR>
<TR>
<TD style="WIDTH: 206px"><STRONG>Production Target:</STRONG></TD>
<TD><asp:textbox id="TextBox8" runat="server"></asp:textb
</TR>
<TR>
<TD style="WIDTH: 206px"><STRONG>Change Of Storage Target:</STRONG></TD>
<TD><asp:textbox id="TextBox9" runat="server"></asp:textb
</TR>
<TR>
<TD style="WIDTH: 206px"><STRONG>Change Of Storage:</STRONG></TD>
<TD><asp:textbox id="TextBox10" runat="server"></asp:textb
</TR>
<TR>
<TD style="WIDTH: 206px"><INPUT style="WIDTH: 72px; HEIGHT: 24px" onclick="javascript:OpenNe
value="Submit">
<asp:button id="Button1" runat="server" Width="64px" Text="Clear"></asp:button>
<TD></TD>
</TR>
</TABLE>
<asp:label id="Label1" style="Z-INDEX: 102; LEFT: 48px; POSITION: absolute; TOP: 216px" runat="server"></asp:label
<HR style="Z-INDEX: 104; LEFT: 16px; POSITION: absolute; TOP: 208px" width="100%" SIZE="1">
<HR style="Z-INDEX: 105; LEFT: 16px; POSITION: absolute; TOP: 240px" width="100%" SIZE="1">
<asp:HyperLink id="HyperLink6" style="Z-INDEX: 107; LEFT: 408px; POSITION: absolute; TOP: 656px"
runat="server" NavigateUrl="view_generati
<asp:HyperLink id="HyperLink7" style="Z-INDEX: 108; LEFT: 16px; POSITION: absolute; TOP: 160px"
runat="server" NavigateUrl="disti.aspx" ImageUrl="file:///C:\Docum
<asp:HyperLink id="HyperLink8" style="Z-INDEX: 109; LEFT: 144px; POSITION: absolute; TOP: 160px"
runat="server" NavigateUrl="line.aspx" ImageUrl="file:///C:\Docum
<asp:HyperLink id="HyperLink9" style="Z-INDEX: 110; LEFT: 272px; POSITION: absolute; TOP: 160px"
runat="server" NavigateUrl="tanks.aspx" ImageUrl="file:///C:\Docum
<asp:HyperLink id="HyperLink10" style="Z-INDEX: 111; LEFT: 400px; POSITION: absolute; TOP: 160px"
runat="server" NavigateUrl="first.aspx" ImageUrl="file:///C:\Docum
<asp:HyperLink id="HyperLink11" style="Z-INDEX: 112; LEFT: 528px; POSITION: absolute; TOP: 160px"
runat="server" NavigateUrl="logout.aspx" ImageUrl="file:///C:\Docum
<HR style="Z-INDEX: 114; LEFT: 16px; POSITION: absolute; TOP: 152px" width="100%" SIZE="1">
<asp:Label id="Label3" style="Z-INDEX: 106; LEFT: 72px; POSITION: absolute; TOP: 656px" runat="server"
Width="328px" Font-Bold="True" Font-Size="Small">To View The Generation Station Operation Data</asp:Label>
</form>
<br>
<br>
<br>
</body>
</HTML>
ASKER
any help with this????
ASKER
any answer for my question,its urgent
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
for that in the page load event write the code (.vb file)--------------------- ->what do u mean by that?
u have a code-behind file? .. basically whereever ur server-side code is ...
I have already given a complete solution using javascript ...
sorry .. vbscript .. client script ...
ASKER