Ask a Question related to ASP, Design and Development.
-
John Davis #1
post the result back to same page??
<html>
<body>
<Form action="calc.asp" method="post" name="calc">
<P>NUM1: <input type="text" name="num1">
<P>NUM2: <input type="text" name="num2">
<P>RESULT: <input type="text" name="result">
<P><input type="submit">
</Form>
I want to write an ASP page to accept 2 numbers, and return the sum on the
same page. Can we do it in pure ASP without JavaScript?? It sounds an easy
problem, and I did that in ASP.NET and JavaScript, but failed in pure ASP
3.0. Here's the attempts, but definitely not what I want because I want the
result back to the text field.
<%
Dim num1, num2, result
num1 = CInt(Request.Form("num1"))
num2 = CInt(Request.Form("num2"))
result = num1 + num2
Response.Write("<P>Num1 = " & num1)
Response.Write("<P>Num2 = " & num2)
Response.Write("<P>Num3 = " & result)
%>
</body>
</html>
John Davis Guest
-
How to Post back page from Client side code?
Hi, I am developing a website in ASP.NET. I want to have a client side code to confirm the deletion of some information from backend database. I... -
#25283 [Fbk->NoF]: SQL Query is pending there, no any result back.
ID: 25283 Updated by: sniper@php.net Reported By: larry_li at contractor dot amat dot com -Status: Feedback... -
Post back
hello all, I have a simple question. on my .aspx page I have bunch of textbox, and dropdowns. One of the dropdown2 has postback = true. When the... -
CSV file uploaded and POST to result page
"Bela" <aleb@tele2.it> wrote in message news:a0daa249.0307150322.51280175@posting.google.com... Hello again, Bela, If you don't want to just... -
Page Post Back -- how to retain selecteditem.value of TWO dropdowns???
Hi, On Page Load (if not postback), the user selects a choice from dropdownlist1. On SelectedItemChanged for dropdownlist1, dropdownlist2 is... -
Ray at home #2
Re: post the result back to same page??
If you want the result to be in the text field for the result, you have to
write the result into the value of that form element as such.
<%
Dim num1, num2, result
num1 = CInt(Request.Form("num1"))
num2 = CInt(Request.Form("num2"))
result = num1 + num2
%>
<html>
<body>
<Form action="calc.asp" method="post" name="calc">
<P>NUM1: <input type="text" name="num1" value="<%=num1%>">
<P>NUM2: <input type="text" name="num2" value="<%=num2%>">
<P>RESULT: <input type="text" name="result" value="<%=result%>">
<P><input type="submit">
</Form>
</body>
</html>
Ray at home
"John Davis" <jrefactor@hotmail.com> wrote in message
news:#AWIKXyeDHA.2356@TK2MSFTNGP12.phx.gbl...the> <html>
> <body>
> <Form action="calc.asp" method="post" name="calc">
> <P>NUM1: <input type="text" name="num1">
> <P>NUM2: <input type="text" name="num2">
> <P>RESULT: <input type="text" name="result">
> <P><input type="submit">
> </Form>
>
> I want to write an ASP page to accept 2 numbers, and return the sum on the
> same page. Can we do it in pure ASP without JavaScript?? It sounds an easy
> problem, and I did that in ASP.NET and JavaScript, but failed in pure ASP
> 3.0. Here's the attempts, but definitely not what I want because I want> result back to the text field.
>
> <%
> Dim num1, num2, result
> num1 = CInt(Request.Form("num1"))
> num2 = CInt(Request.Form("num2"))
> result = num1 + num2
> Response.Write("<P>Num1 = " & num1)
> Response.Write("<P>Num2 = " & num2)
> Response.Write("<P>Num3 = " & result)
> %>
>
>
> </body>
> </html>
>
>
Ray at home Guest
-
dlbjr #3
Re: post the result back to same page??
<%
dblNum1 = Trim(Request("num1"))
dblNum2 = Trim(Request("num2"))
If IsNUmeric(dblNum1) And IsNumeric(dblNum2) Then
Select Case UCase(Trim(Request("CHOICE")))
Case "ADD"
dblAnswer = CDbl(dblNum1) + CDbl(dblNum2)
Case "SUBTRACT"
dblAnswer = CDbl(dblNum1) - CDbl(dblNum2)
Case "MULTIPLY"
dblAnswer = CDbl(dblNum1) * CDbl(dblNum2)
Case "DIVIDE"
dblAnswer = CDbl(dblNum1) / CDbl(dblNum2)
Case Else
dblAnswer = ""
End Select
End If
%>
<html>
<body>
<form action="addtest.asp" method="post" name="calc" ID="Form1">
NUM1: <input type="text" name="num1" value="<%=dblNum1%>"><br>
NUM2: <input type="text" name="num2" value="<%=dblNum2%>"><br>
RESULT: <input type="text" name="result" value="<%=dblAnswer%>"><br>
<input type="submit" name="CHOICE" value="Add">
<input type="submit" name="CHOICE" value="Subtract">
<input type="submit" name="CHOICE" value="Multiply">
<input type="submit" name="CHOICE" value="Divide">
</form>
</body>
</html>
-dlbjr
invariable unerring alien
dlbjr Guest
-
John Davis #4
Re: post the result back to same page??
yeah, that's what I want, except each text field is filled with 0 before the
user enters any number. Any workarounds on that??
"Ray at home" <myfirstname at lane 34 . komm> wrote in message
news:e#Dc7xyeDHA.3616@TK2MSFTNGP11.phx.gbl...the> If you want the result to be in the text field for the result, you have to
> write the result into the value of that form element as such.
>
>
> <%
> Dim num1, num2, result
> num1 = CInt(Request.Form("num1"))
> num2 = CInt(Request.Form("num2"))
> result = num1 + num2
> %>
>
> <html>
> <body>
> <Form action="calc.asp" method="post" name="calc">
> <P>NUM1: <input type="text" name="num1" value="<%=num1%>">
> <P>NUM2: <input type="text" name="num2" value="<%=num2%>">
> <P>RESULT: <input type="text" name="result" value="<%=result%>">
> <P><input type="submit">
> </Form>
>
>
>
>
> </body>
> </html>
>
> Ray at home
>
>
>
>
> "John Davis" <jrefactor@hotmail.com> wrote in message
> news:#AWIKXyeDHA.2356@TK2MSFTNGP12.phx.gbl...> > <html>
> > <body>
> > <Form action="calc.asp" method="post" name="calc">
> > <P>NUM1: <input type="text" name="num1">
> > <P>NUM2: <input type="text" name="num2">
> > <P>RESULT: <input type="text" name="result">
> > <P><input type="submit">
> > </Form>
> >
> > I want to write an ASP page to accept 2 numbers, and return the sum oneasy> > same page. Can we do it in pure ASP without JavaScript?? It sounds anASP> > problem, and I did that in ASP.NET and JavaScript, but failed in pure> the> > 3.0. Here's the attempts, but definitely not what I want because I want>> > result back to the text field.
> >
> > <%
> > Dim num1, num2, result
> > num1 = CInt(Request.Form("num1"))
> > num2 = CInt(Request.Form("num2"))
> > result = num1 + num2
> > Response.Write("<P>Num1 = " & num1)
> > Response.Write("<P>Num2 = " & num2)
> > Response.Write("<P>Num3 = " & result)
> > %>
> >
> >
> > </body>
> > </html>
> >
> >
>
John Davis Guest
-
Ken Schaefer #5
Re: post the result back to same page??
Just detect if the form has been posted or not.
<%
If UCase(Request.ServerVariables("Request_Method")) = "POST" then
intNum1 = Request.Form("txtNumber1")
intNum2 = Request.Form("txtNumber2")
intTotal = intNum1 + intNum2
Else
intNum1 = 0
intNum2 = 0
End If
%>
<html>
<head>
</head>
<body>
<form method="post">
<input type="text" name="txtNumber1" value="<%=intNum1%>"><br>
<input type="text" name="txtNumber2" value="<%=intNum2%>"><br>
<input type="submit">
</form>
<p>
The total is: <%=intTotal%>
</p>
</body>
</html>
"John Davis" <jrefactor@hotmail.com> wrote in message
news:OmZksr0eDHA.1732@TK2MSFTNGP12.phx.gbl...
: yeah, that's what I want, except each text field is filled with 0 before
the
: user enters any number. Any workarounds on that??
:
: "Ray at home" <myfirstname at lane 34 . komm> wrote in message
: news:e#Dc7xyeDHA.3616@TK2MSFTNGP11.phx.gbl...
: > If you want the result to be in the text field for the result, you have
to
: > write the result into the value of that form element as such.
: >
: >
: > <%
: > Dim num1, num2, result
: > num1 = CInt(Request.Form("num1"))
: > num2 = CInt(Request.Form("num2"))
: > result = num1 + num2
: > %>
: >
: > <html>
: > <body>
: > <Form action="calc.asp" method="post" name="calc">
: > <P>NUM1: <input type="text" name="num1" value="<%=num1%>">
: > <P>NUM2: <input type="text" name="num2" value="<%=num2%>">
: > <P>RESULT: <input type="text" name="result" value="<%=result%>">
: > <P><input type="submit">
: > </Form>
: >
: >
: >
: >
: > </body>
: > </html>
: >
: > Ray at home
: >
: >
: >
: >
: > "John Davis" <jrefactor@hotmail.com> wrote in message
: > news:#AWIKXyeDHA.2356@TK2MSFTNGP12.phx.gbl...
: > > <html>
: > > <body>
: > > <Form action="calc.asp" method="post" name="calc">
: > > <P>NUM1: <input type="text" name="num1">
: > > <P>NUM2: <input type="text" name="num2">
: > > <P>RESULT: <input type="text" name="result">
: > > <P><input type="submit">
: > > </Form>
: > >
: > > I want to write an ASP page to accept 2 numbers, and return the sum on
: the
: > > same page. Can we do it in pure ASP without JavaScript?? It sounds an
: easy
: > > problem, and I did that in ASP.NET and JavaScript, but failed in pure
: ASP
: > > 3.0. Here's the attempts, but definitely not what I want because I
want
: > the
: > > result back to the text field.
: > >
: > > <%
: > > Dim num1, num2, result
: > > num1 = CInt(Request.Form("num1"))
: > > num2 = CInt(Request.Form("num2"))
: > > result = num1 + num2
: > > Response.Write("<P>Num1 = " & num1)
: > > Response.Write("<P>Num2 = " & num2)
: > > Response.Write("<P>Num3 = " & result)
: > > %>
: > >
: > >
: > > </body>
: > > </html>
: > >
: > >
: >
: >
:
:
Ken Schaefer Guest



Reply With Quote

