Link to home
Start Free TrialLog in
Avatar of noor21
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???
ASKER CERTIFIED SOLUTION
Avatar of Maulik Modi
Maulik Modi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of noor21
noor21

ASKER

i am using vb.net and i am really finding it hard to read ur java code,is there link on text click pop up message
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
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 ...
Avatar of noor21

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_confirm.aspx', '', 'menu=no,location=no,status=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,outflow_target,inflow_actual,outflow_actual,storage,change_of_storage_target,change_of_storage) values (@txttext1,@texttest2,@txttest3,@txttest4,@txttest5,@txttest6,@txttest7,@txttest8,@txttest9)"
            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.RegisterClientScriptBlock("ErroOnPage", 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").DefaultView
        mydatagrid.DataBind()
    End Sub
i asked for the aspx code of the page where u want the validation ...
Avatar of noor21

ASKER

thats it Rejojohny:

Try
            Dim MySQL As String = "Insert into pumping_station_operation_data([date],station_id,inflow_target,outflow_target,inflow_actual,outflow_actual,storage,change_of_storage_target,change_of_storage) values (@txttext1,@texttest2,@txttest3,@txttest4,@txttest5,@txttest6,@txttest7,@txttest8,@txttest9)"
            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.RegisterClientScriptBlock("ErroOnPage", 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").DefaultView
        mydatagrid.DataBind()
    End Sub


i mean the script .. the HTML (ASPX) page .. the tags .. <asp:textbox> etc ....
Avatar of noor21

ASKER

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm4.aspx.vb" Inherits="water_control.WebForm4"%>
<!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_defaultClientScript">
            <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
            <script language="javascript">
               function OpenNewWindow()
               {
                    window.open('WebForm5.aspx', '', 'menu=no,location=no,status=no');
               }
            </script>
      </HEAD>
      <body MS_POSITIONING="GridLayout" background="file:///C:/Documents%20and%20Settings/Desktop/design/wcc_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:</STRONG></TD>
                              <TD style="HEIGHT: 31px"><asp:textbox id="TextBox1" runat="server"></asp:textbox></TD>
                        </TR>
                        <TR>
                              <TD style="WIDTH: 206px"><STRONG>Station Name:</STRONG></TD>
                              <TD><asp:dropdownlist id="ddlcustomer" runat="server" Width="120px"></asp:dropdownlist></TD>
                        </TR>
                        <TR>
                              <TD style="WIDTH: 206px"><STRONG>Production:</STRONG></TD>
                              <TD><asp:textbox id="TextBox3" runat="server"></asp:textbox></TD>
                        </TR>
                        <TR>
                              <TD style="WIDTH: 206px"><STRONG>Outflow:</STRONG></TD>
                              <TD><asp:textbox id="TextBox4" runat="server"></asp:textbox></TD>
                        </TR>
                        <TR>
                              <TD style="WIDTH: 206px"><STRONG>Storage:</STRONG></TD>
                              <TD><asp:textbox id="TextBox5" runat="server"></asp:textbox></TD>
                        </TR>
                        <TR>
                              <TD style="WIDTH: 206px"><STRONG>Internal Consumption:</STRONG></TD>
                              <TD><asp:textbox id="TextBox6" runat="server"></asp:textbox></TD>
                        </TR>
                        <TR>
                              <TD style="WIDTH: 206px"><STRONG>Total MGD:</STRONG></TD>
                              <TD><asp:textbox id="TextBox7" runat="server"></asp:textbox></TD>
                        </TR>
                        <TR>
                              <TD style="WIDTH: 206px"><STRONG>Production Target:</STRONG></TD>
                              <TD><asp:textbox id="TextBox8" runat="server"></asp:textbox></TD>
                        </TR>
                        <TR>
                              <TD style="WIDTH: 206px"><STRONG>Change Of&nbsp; Storage Target:</STRONG></TD>
                              <TD><asp:textbox id="TextBox9" runat="server"></asp:textbox></TD>
                        </TR>
                        <TR>
                              <TD style="WIDTH: 206px"><STRONG>Change Of&nbsp; Storage:</STRONG></TD>
                              <TD><asp:textbox id="TextBox10" runat="server"></asp:textbox></TD>
                        </TR>
                        <TR>
                              <TD style="WIDTH: 206px"><INPUT style="WIDTH: 72px; HEIGHT: 24px" onclick="javascript:OpenNewWindow();" 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:label 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_generation.aspx">Click 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:\Documents and Settings\Desktop\design\wcc_pic\button3D.jpg">HyperLink</asp:HyperLink>
                  <asp:HyperLink id="HyperLink8" style="Z-INDEX: 109; LEFT: 144px; POSITION: absolute; TOP: 160px"
                        runat="server" NavigateUrl="line.aspx" ImageUrl="file:///C:\Documents and Settings\Desktop\design\wcc_pic\button40.jpg">HyperLink</asp:HyperLink>
                  <asp:HyperLink id="HyperLink9" style="Z-INDEX: 110; LEFT: 272px; POSITION: absolute; TOP: 160px"
                        runat="server" NavigateUrl="tanks.aspx" ImageUrl="file:///C:\Documents and Settings\Desktop\design\wcc_pic\button43.jpg">HyperLink</asp:HyperLink>
                  <asp:HyperLink id="HyperLink10" style="Z-INDEX: 111; LEFT: 400px; POSITION: absolute; TOP: 160px"
                        runat="server" NavigateUrl="first.aspx" ImageUrl="file:///C:\Documents and Settings\Desktop\design\wcc_pic\button46.jpg">HyperLink</asp:HyperLink>
                  <asp:HyperLink id="HyperLink11" style="Z-INDEX: 112; LEFT: 528px; POSITION: absolute; TOP: 160px"
                        runat="server" NavigateUrl="logout.aspx" ImageUrl="file:///C:\Documents and Settings\Desktop\design\wcc_pic\button22.jpg">HyperLink</asp:HyperLink><IMG style="Z-INDEX: 113; LEFT: 24px; POSITION: absolute; TOP: 16px" alt="" src="file:///C:\Documents and Settings\Desktop\design\wcc_pic\UNTITLED-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>
Avatar of noor21

ASKER

any help with this????
Avatar of noor21

ASKER

any answer for my question,its urgent
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of noor21

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 ...