468,727 Members | 1,619 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,727 developers. It's quick & easy.

Request.Form in Javascript

Hi,

Can I:

<script language="javascript">
var TimeSec = new String (Request.form("TimeInSec"));
or

<script language="javascript">
var TimeSec = new int(Request.form("TimeInSec"));

or

<script language="javascript">
var TimeSec = Request.form("TimeInSec");

All three seems not working. Any workaround ? Thanks.

Regards,
Magix

Dec 22 '07 #1
6 13448
magix wrote:
All three seems not working. Any workaround ? Thanks.
What exactly are you trying to achieve? Do you want to use JScript on
the server in classic ASP? Or JScript.NET with ASP.NET? Or something else?
--

Martin Honnen
http://JavaScript.FAQTs.com/
Dec 22 '07 #2
For example, there are 2 files, file1.asp and file2.asp
in File1.asp, i have
<form name="abc" method="post" action="file2.asp">

loop through some Db table record, and assign the value, like
<input type="hidden" name="QTimeInSec" value="<%=QTimeInSec%>">
</form>
after SUBMIT the form,
in File2.asp, i need to assign the value of request.form("TimeInSec") to
javascript variables for some further actions.
So, just wonder on how to apply the usage of Request.Form in javascript.

<script language="javascript">
var TimeSec = new string (request.form("TimeInSec"));
...
...
</script>

"Martin Honnen" <ma*******@yahoo.dewrote in message
news:47***********************@newsspool3.arcor-online.net...
magix wrote:
>All three seems not working. Any workaround ? Thanks.

What exactly are you trying to achieve? Do you want to use JScript on the
server in classic ASP? Or JScript.NET with ASP.NET? Or something else?
--

Martin Honnen
http://JavaScript.FAQTs.com/

Dec 22 '07 #3
magix wrote:
For example, there are 2 files, file1.asp and file2.asp
in File1.asp, i have
<form name="abc" method="post" action="file2.asp">

loop through some Db table record, and assign the value, like
<input type="hidden" name="QTimeInSec" value="<%=QTimeInSec%>">
</form>
after SUBMIT the form,
in File2.asp, i need to assign the value of request.form("TimeInSec") to
javascript variables for some further actions.
So, just wonder on how to apply the usage of Request.Form in javascript.

<script language="javascript">
var TimeSec = new string (request.form("TimeInSec"));
...
...
</script>
Do you want to use JScript on the server instead of VBScript? Or do you
use VBScript in your ASP pages and want to pass values to client-side
JavaScript?
--

Martin Honnen
http://JavaScript.FAQTs.com/
Dec 22 '07 #4
I just want to pass the parameter value to javascript in another asp file.

Question is how's the usage of Request.Form in javascript ? Or is it
possible to use Request.Form in javascript

Regards.

"Martin Honnen" <ma*******@yahoo.dewrote in message
news:47***********************@newsspool2.arcor-online.net...
magix wrote:
>For example, there are 2 files, file1.asp and file2.asp
in File1.asp, i have
<form name="abc" method="post" action="file2.asp">

loop through some Db table record, and assign the value, like
<input type="hidden" name="QTimeInSec" value="<%=QTimeInSec%>">
</form>
after SUBMIT the form,
in File2.asp, i need to assign the value of request.form("TimeInSec") to
javascript variables for some further actions.
So, just wonder on how to apply the usage of Request.Form in javascript.

<script language="javascript">
var TimeSec = new string (request.form("TimeInSec"));
...
...
</script>

Do you want to use JScript on the server instead of VBScript? Or do you
use VBScript in your ASP pages and want to pass values to client-side
JavaScript?
--

Martin Honnen
http://JavaScript.FAQTs.com/

Dec 22 '07 #5
magix wrote on 22 dec 2007 in comp.lang.javascript:
<script language="javascript">
var TimeSec = new string (request.form("TimeInSec"));
...
...
</script>
You are mixing serverside code,
ASP-vbscript or ASP-j[ava]script,
with clientside Javascript.

That is imposible as the two interpreters run on seperate machines
and not even at the same time.
Serverside coding renders a stream of HTML [+ clientside scripts]
that are sent to the client, read browser.

ASP Request.form() returns a string if it exists.
So try this:

<script language="javascript">
var s = '<% = request.form("v1") %>'; // posting a string
var n = <% = request.form("v2") %>; // posting a number
</script>

The string should not contain '-s

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Dec 22 '07 #6
Thanks Evertjan. This works well.
"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@194.109.133.242...
magix wrote on 22 dec 2007 in comp.lang.javascript:
><script language="javascript">
var TimeSec = new string (request.form("TimeInSec"));
...
...
</script>

You are mixing serverside code,
ASP-vbscript or ASP-j[ava]script,
with clientside Javascript.

That is imposible as the two interpreters run on seperate machines
and not even at the same time.
Serverside coding renders a stream of HTML [+ clientside scripts]
that are sent to the client, read browser.

ASP Request.form() returns a string if it exists.
So try this:

<script language="javascript">
var s = '<% = request.form("v1") %>'; // posting a string
var n = <% = request.form("v2") %>; // posting a number
</script>

The string should not contain '-s

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Dec 22 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Robert Mark Bram | last post: by
8 posts views Thread by George | last post: by
10 posts views Thread by Mr Newbie | last post: by
5 posts views Thread by =?Utf-8?B?QVRT?= | last post: by
1 post views Thread by CARIGAR | last post: by
9 posts views Thread by bryonone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.