Displaying calculation result without reloading whole ASP page

Discussion in 'ASP General' started by Aspersion, Jul 5, 2003.

  1. Aspersion

    Aspersion Guest

    I'm building an ASP page that has a lot of text and graphics.

    There is a calculation facility on the page. The user enters several
    numbers in a form and presses a button to see the calculated answer.

    The problem is this: when the user presses the Calculate button, the
    whole page is reloaded and, on a large page, this is very noticeable.

    Is there any way that I can get the calculation done and the result
    displayed without reloading the whole page?

    A simplified version of the page "calctest.asp" is shown below.

    <!-- ignore html on usenet
    <html>
    <head>
    <title>
    This is calctest.asp
    </title>
    </head>

    <body>
    <h1>This is the test page</h1>

    There are a lot of words and graphics displayed here.

    <%
    Var1 = trim(Request.Form("VarA"))
    Var2 = trim(Request.Form("VarB"))
    Var3 = Var1 * Var2
    %>

    <FORM Name=Calculation Action=calctest.asp Method=Post>
    <input type="text" name="VarA" size="2" value=<%=Var1%>>
    &nbsp;
    <input type="text" name="VarB" size="2" value=<%=Var2%>>
    &nbsp;
    <input type="text" name="VarC" size="3" value=<%=Var3%>>
    &nbsp;
    <INPUT Type="Submit" Value="Calculate" Name="btnSubmit">
    <p>
    </FORM>

    </body>
    </html>
    end ignore html on usenet -->
    Aspersion, Jul 5, 2003
    #1
    1. Advertising

  2. If the calculation is simple and you do not care if the user sees the
    algorithm, do the calculation in JavaScript and do not go back to the
    server.

    "Aspersion" <> wrote in message
    news:be77fc$1sosv$...
    >
    >
    > I'm building an ASP page that has a lot of text and graphics.
    >
    > There is a calculation facility on the page. The user enters several
    > numbers in a form and presses a button to see the calculated answer.
    >
    > The problem is this: when the user presses the Calculate button, the
    > whole page is reloaded and, on a large page, this is very noticeable.
    >
    > Is there any way that I can get the calculation done and the result
    > displayed without reloading the whole page?
    >
    > A simplified version of the page "calctest.asp" is shown below.
    >
    > <!-- ignore html on usenet
    > <html>
    > <head>
    > <title>
    > This is calctest.asp
    > </title>
    > </head>
    >
    > <body>
    > <h1>This is the test page</h1>
    >
    > There are a lot of words and graphics displayed here.
    >
    > <%
    > Var1 = trim(Request.Form("VarA"))
    > Var2 = trim(Request.Form("VarB"))
    > Var3 = Var1 * Var2
    > %>
    >
    > <FORM Name=Calculation Action=calctest.asp Method=Post>
    > <input type="text" name="VarA" size="2" value=<%=Var1%>>
    > &nbsp;
    > <input type="text" name="VarB" size="2" value=<%=Var2%>>
    > &nbsp;
    > <input type="text" name="VarC" size="3" value=<%=Var3%>>
    > &nbsp;
    > <INPUT Type="Submit" Value="Calculate" Name="btnSubmit">
    > <p>
    > </FORM>
    >
    > </body>
    > </html>
    > end ignore html on usenet -->
    Marvin Thompson, Jul 5, 2003
    #2
    1. Advertising

  3. Aspersion

    Aspersion Guest

    On Sat, 5 Jul 2003 14:12:23 -0500, "Marvin Thompson"
    <> wrote:

    >If the calculation is simple and you do not care if the user sees the
    >algorithm, do the calculation in JavaScript and do not go back to the
    >server.


    Thanks, but I don't want the user to know how the calculation works.
    As for JavaScript, not everyone uses it.

    >"Aspersion" <> wrote in message
    >news:be77fc$1sosv$...
    >>
    >>
    >> I'm building an ASP page that has a lot of text and graphics.
    >>
    >> There is a calculation facility on the page. The user enters several
    >> numbers in a form and presses a button to see the calculated answer.
    >>
    >> The problem is this: when the user presses the Calculate button, the
    >> whole page is reloaded and, on a large page, this is very noticeable.
    >>
    >> Is there any way that I can get the calculation done and the result
    >> displayed without reloading the whole page?
    >>
    >> A simplified version of the page "calctest.asp" is shown below.
    >>
    >> <!-- ignore html on usenet
    >> <html>
    >> <head>
    >> <title>
    >> This is calctest.asp
    >> </title>
    >> </head>
    >>
    >> <body>
    >> <h1>This is the test page</h1>
    >>
    >> There are a lot of words and graphics displayed here.
    >>
    >> <%
    >> Var1 = trim(Request.Form("VarA"))
    >> Var2 = trim(Request.Form("VarB"))
    >> Var3 = Var1 * Var2
    >> %>
    >>
    >> <FORM Name=Calculation Action=calctest.asp Method=Post>
    >> <input type="text" name="VarA" size="2" value=<%=Var1%>>
    >> &nbsp;
    >> <input type="text" name="VarB" size="2" value=<%=Var2%>>
    >> &nbsp;
    >> <input type="text" name="VarC" size="3" value=<%=Var3%>>
    >> &nbsp;
    >> <INPUT Type="Submit" Value="Calculate" Name="btnSubmit">
    >> <p>
    >> </FORM>
    >>
    >> </body>
    >> </html>
    >> end ignore html on usenet -->

    >
    Aspersion, Jul 5, 2003
    #3
  4. OK, you can hide the algorithm with an include file. As for JavaScript,
    only IE understands VBscript. All browsers understand JavaScript. All
    client side scripting requires that you learn JavaScript. Server side
    scripting can be VBscript. Good luck.


    "Aspersion" <> wrote in message
    news:be798r$21oa8$...
    > On Sat, 5 Jul 2003 14:12:23 -0500, "Marvin Thompson"
    > <> wrote:
    >
    > >If the calculation is simple and you do not care if the user sees the
    > >algorithm, do the calculation in JavaScript and do not go back to the
    > >server.

    >
    > Thanks, but I don't want the user to know how the calculation works.
    > As for JavaScript, not everyone uses it.
    >
    > >"Aspersion" <> wrote in message
    > >news:be77fc$1sosv$...
    > >>
    > >>
    > >> I'm building an ASP page that has a lot of text and graphics.
    > >>
    > >> There is a calculation facility on the page. The user enters several
    > >> numbers in a form and presses a button to see the calculated answer.
    > >>
    > >> The problem is this: when the user presses the Calculate button, the
    > >> whole page is reloaded and, on a large page, this is very noticeable.
    > >>
    > >> Is there any way that I can get the calculation done and the result
    > >> displayed without reloading the whole page?
    > >>
    > >> A simplified version of the page "calctest.asp" is shown below.
    > >>
    > >> <!-- ignore html on usenet
    > >> <html>
    > >> <head>
    > >> <title>
    > >> This is calctest.asp
    > >> </title>
    > >> </head>
    > >>
    > >> <body>
    > >> <h1>This is the test page</h1>
    > >>
    > >> There are a lot of words and graphics displayed here.
    > >>
    > >> <%
    > >> Var1 = trim(Request.Form("VarA"))
    > >> Var2 = trim(Request.Form("VarB"))
    > >> Var3 = Var1 * Var2
    > >> %>
    > >>
    > >> <FORM Name=Calculation Action=calctest.asp Method=Post>
    > >> <input type="text" name="VarA" size="2" value=<%=Var1%>>
    > >> &nbsp;
    > >> <input type="text" name="VarB" size="2" value=<%=Var2%>>
    > >> &nbsp;
    > >> <input type="text" name="VarC" size="3" value=<%=Var3%>>
    > >> &nbsp;
    > >> <INPUT Type="Submit" Value="Calculate" Name="btnSubmit">
    > >> <p>
    > >> </FORM>
    > >>
    > >> </body>
    > >> </html>
    > >> end ignore html on usenet -->

    > >

    >
    Marvin Thompson, Jul 6, 2003
    #4
  5. Aspersion

    Aspersion Guest

    On Sat, 5 Jul 2003 23:20:28 -0500, "Marvin Thompson"
    <> wrote:

    >OK, you can hide the algorithm with an include file. As for JavaScript,
    >only IE understands VBscript. All browsers understand JavaScript. All
    >client side scripting requires that you learn JavaScript. Server side
    >scripting can be VBscript. Good luck.


    Thanks for the input. When I said that not everyone uses JavaScript, I
    meant that some people, including me, have it disabled on their
    machine for security purposes.

    The reason I want to handle the whole process server side is so that
    any client configuration will see the same website.

    BTW, include files don't hide your client side code from the really
    determined. If their computer can read it, they can read it.

    >"Aspersion" <> wrote in message
    >news:be798r$21oa8$...
    >> On Sat, 5 Jul 2003 14:12:23 -0500, "Marvin Thompson"
    >> <> wrote:
    >>
    >> >If the calculation is simple and you do not care if the user sees the
    >> >algorithm, do the calculation in JavaScript and do not go back to the
    >> >server.

    >>
    >> Thanks, but I don't want the user to know how the calculation works.
    >> As for JavaScript, not everyone uses it.
    >>
    >> >"Aspersion" <> wrote in message
    >> >news:be77fc$1sosv$...
    >> >>
    >> >>
    >> >> I'm building an ASP page that has a lot of text and graphics.
    >> >>
    >> >> There is a calculation facility on the page. The user enters several
    >> >> numbers in a form and presses a button to see the calculated answer.
    >> >>
    >> >> The problem is this: when the user presses the Calculate button, the
    >> >> whole page is reloaded and, on a large page, this is very noticeable.
    >> >>
    >> >> Is there any way that I can get the calculation done and the result
    >> >> displayed without reloading the whole page?
    >> >>
    >> >> A simplified version of the page "calctest.asp" is shown below.
    >> >>
    >> >> <!-- ignore html on usenet
    >> >> <html>
    >> >> <head>
    >> >> <title>
    >> >> This is calctest.asp
    >> >> </title>
    >> >> </head>
    >> >>
    >> >> <body>
    >> >> <h1>This is the test page</h1>
    >> >>
    >> >> There are a lot of words and graphics displayed here.
    >> >>
    >> >> <%
    >> >> Var1 = trim(Request.Form("VarA"))
    >> >> Var2 = trim(Request.Form("VarB"))
    >> >> Var3 = Var1 * Var2
    >> >> %>
    >> >>
    >> >> <FORM Name=Calculation Action=calctest.asp Method=Post>
    >> >> <input type="text" name="VarA" size="2" value=<%=Var1%>>
    >> >> &nbsp;
    >> >> <input type="text" name="VarB" size="2" value=<%=Var2%>>
    >> >> &nbsp;
    >> >> <input type="text" name="VarC" size="3" value=<%=Var3%>>
    >> >> &nbsp;
    >> >> <INPUT Type="Submit" Value="Calculate" Name="btnSubmit">
    >> >> <p>
    >> >> </FORM>
    >> >>
    >> >> </body>
    >> >> </html>
    >> >> end ignore html on usenet -->
    >> >

    >>

    >
    Aspersion, Jul 6, 2003
    #5
  6. Aspersion

    Evertjan. Guest

    Aspersion wrote on 06 jul 2003 in
    microsoft.public.inetserver.asp.general:
    > On 05 Jul 2003 20:01:29 GMT, "Evertjan." wrote:
    >>Aspersion wrote on 05 jul 2003 :
    >>> Thanks, but I don't want the user to know how the calculation works.
    >>> As for JavaScript, not everyone uses it.

    >>
    >>You can do this with concealed iframes, but you will need clientside
    >>code to realize this.

    >
    > Thanks, but I don't want any client side code. The whole process must
    > run on the server.


    That is what I said. The proces runs on the server, but either you load a
    new page everuy time or you use clientside code to load the output in a
    concealed iframe and then using it on your initial page.

    That is your choice

    > Some users disable JavaScript


    You mean, I think, some users disable clientside code, this can be
    javascript and [in IE] vbscript, just as serverside code can be in
    javascript, vbscript, and many more.

    > and, besides, I don't want to make the code visible.


    The code of your secret algorithm is not accessable, as it stays
    serverside. only the code to enter the result on the clients screen
    without a total refresh is clientside.

    > That leaves me with the original problem: how do I refresh a box on
    > the page to show a calculated result without having to re-send the
    > whole page?


    Impossible without clientside scripting.


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Jul 6, 2003
    #6
  7. Aspersion

    Aspersion Guest

    On 06 Jul 2003 12:51:14 GMT, "Evertjan."
    <> wrote:


    >That is what I said. The proces runs on the server, but either you load a
    >new page everuy time or you use clientside code to load the output in a
    >concealed iframe and then using it on your initial page.


    Iframes are limited. Like other frames, they're not very search engine
    friendly. I'm also left with the client side code problem. You can't
    depend on the client machine to run your code properly.

    >> That leaves me with the original problem: how do I refresh a box on
    >> the page to show a calculated result without having to re-send the
    >> whole page?

    >
    >Impossible without clientside scripting.


    I thought that, but I was hoping somebody knew better.

    Thanks for your thoughts.
    Aspersion, Jul 6, 2003
    #7
  8. Aspersion

    Linda Guest

    Have you tried using Remote Scripting? The premise of this technology is
    that it will do calculations without reloading the whole page. It's

    tricky...you'll have to read the documentation on it carefully, (and it
    doesn't work in Netscape) but, if you have a specific audience that uses

    only IE it can be your answer.

    Good luck,

    Linda

    "Aspersion" <> wrote in message
    news:be77fc$1sosv$...
    >
    >
    > I'm building an ASP page that has a lot of text and graphics.
    >
    > There is a calculation facility on the page. The user enters several
    > numbers in a form and presses a button to see the calculated answer.
    >
    > The problem is this: when the user presses the Calculate button, the
    > whole page is reloaded and, on a large page, this is very noticeable.
    >
    > Is there any way that I can get the calculation done and the result
    > displayed without reloading the whole page?
    >
    > A simplified version of the page "calctest.asp" is shown below.
    >
    > <!-- ignore html on usenet
    > <html>
    > <head>
    > <title>
    > This is calctest.asp
    > </title>
    > </head>
    >
    > <body>
    > <h1>This is the test page</h1>
    >
    > There are a lot of words and graphics displayed here.
    >
    > <%
    > Var1 = trim(Request.Form("VarA"))
    > Var2 = trim(Request.Form("VarB"))
    > Var3 = Var1 * Var2
    > %>
    >
    > <FORM Name=Calculation Action=calctest.asp Method=Post>
    > <input type="text" name="VarA" size="2" value=<%=Var1%>>
    > &nbsp;
    > <input type="text" name="VarB" size="2" value=<%=Var2%>>
    > &nbsp;
    > <input type="text" name="VarC" size="3" value=<%=Var3%>>
    > &nbsp;
    > <INPUT Type="Submit" Value="Calculate" Name="btnSubmit">
    > <p>
    > </FORM>
    >
    > </body>
    > </html>
    > end ignore html on usenet -->
    Linda, Aug 11, 2003
    #8
  9. Aspersion

    Bob Barrows Guest

    Another option is xmlhttp. I have a demo for this at
    http://tinyurl.com/5luf. Scroll down to the dynamic listbox example.

    Bob Barrows
    Aspersion wrote:
    > I'm building an ASP page that has a lot of text and graphics.
    >
    > There is a calculation facility on the page. The user enters several
    > numbers in a form and presses a button to see the calculated answer.
    >
    > The problem is this: when the user presses the Calculate button, the
    > whole page is reloaded and, on a large page, this is very noticeable.
    >
    > Is there any way that I can get the calculation done and the result
    > displayed without reloading the whole page?
    >
    > A simplified version of the page "calctest.asp" is shown below.
    >
    > <!-- ignore html on usenet
    > <html>
    > <head>
    > <title>
    > This is calctest.asp
    > </title>
    > </head>
    >
    > <body>
    > <h1>This is the test page</h1>
    >
    > There are a lot of words and graphics displayed here.
    >
    > <%
    > Var1 = trim(Request.Form("VarA"))
    > Var2 = trim(Request.Form("VarB"))
    > Var3 = Var1 * Var2
    > %>
    >
    > <FORM Name=Calculation Action=calctest.asp Method=Post>
    > <input type="text" name="VarA" size="2" value=<%=Var1%>>
    > &nbsp;
    > <input type="text" name="VarB" size="2" value=<%=Var2%>>
    > &nbsp;
    > <input type="text" name="VarC" size="3" value=<%=Var3%>>
    > &nbsp;
    > <INPUT Type="Submit" Value="Calculate" Name="btnSubmit">
    > <p>
    > </FORM>
    >
    > </body>
    > </html>
    > end ignore html on usenet -->
    Bob Barrows, Aug 11, 2003
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Urs Vogel
    Replies:
    2
    Views:
    2,404
    Urs Vogel
    Jun 10, 2004
  2. Richard
    Replies:
    3
    Views:
    541
    Richard
    Jul 22, 2004
  3. Daylor
    Replies:
    1
    Views:
    447
    Saravana
    Nov 22, 2004
  4. \A_Michigan_User\
    Replies:
    2
    Views:
    885
    \A_Michigan_User\
    Aug 21, 2006
  5. Michael Tan
    Replies:
    32
    Views:
    960
    Ara.T.Howard
    Jul 21, 2005
Loading...

Share This Page