JavaScript and ASP

P

Paulo Roberto

Hi everybody, how r u? I hope fine...

People, I have a Javascript function wich returns true ou false, how do I
assign the result on ASP variable?

<% blnResult = Javascript:function() %>

All these work because I have a form wich fields are verified by JavaScript
on the client...

Is that possible to do?
 
E

Evertjan.

Paulo Roberto wrote on 05 sep 2006 in
microsoft.public.inetserver.asp.general:
Hi everybody, how r u? I hope fine...

Please write normally this is usenet!
People, I have a Javascript function wich returns true ou false, how
do I assign the result on ASP variable?

I hope you mean serverside Javascript, as clientside Javascript
only executes when the serverside rendering has finisched.
<% blnResult = Javascript:function() %>

<% 'supposing this ids the default vbscript
myResult = myJavascriptFunction()
%>
All these work because I have a form wich fields are verified by
JavaScript on the client...

So it is clientside Javascript?
Is that possible to do?

You will have to send that to the server by a <form> construct,
[or Ajax technology]
because the serverside coding of the original page has ended long before.

Please read up on ASP.
 
P

Paulo Roberto

Sorry Evertjan,

Hi everybody, how are you? I hope fine...

Resuming, what I need to know if is it possible to interchange ASP and
client JavaScript results.

Example: after the user has pressed submit form and the client JavaScript
has checked all fields I want the result being stored in a ASP variable, can
you understand?

thanks

Evertjan. said:
Paulo Roberto wrote on 05 sep 2006 in
microsoft.public.inetserver.asp.general:
Hi everybody, how r u? I hope fine...

Please write normally this is usenet!
People, I have a Javascript function wich returns true ou false, how
do I assign the result on ASP variable?

I hope you mean serverside Javascript, as clientside Javascript
only executes when the serverside rendering has finisched.
<% blnResult = Javascript:function() %>

<% 'supposing this ids the default vbscript
myResult = myJavascriptFunction()
%>
All these work because I have a form wich fields are verified by
JavaScript on the client...

So it is clientside Javascript?
Is that possible to do?

You will have to send that to the server by a <form> construct,
[or Ajax technology]
because the serverside coding of the original page has ended long before.

Please read up on ASP.
 
E

Evertjan.

Paulo Roberto wrote on 05 sep 2006 in
microsoft.public.inetserver.asp.general:
Evertjan. said:
Paulo Roberto wrote on 05 sep 2006 in
microsoft.public.inetserver.asp.general:
Hi everybody, how r u? I hope fine...

Please write normally this is usenet!
People, I have a Javascript function wich returns true ou false,
how do I assign the result on ASP variable?

I hope you mean serverside Javascript, as clientside Javascript
only executes when the serverside rendering has finisched.
<% blnResult = Javascript:function() %>

<% 'supposing this ids the default vbscript
myResult = myJavascriptFunction()
%>
All these work because I have a form wich fields are verified by
JavaScript on the client...

So it is clientside Javascript?
Is that possible to do?

You will have to send that to the server by a <form> construct,
[or Ajax technology]
because the serverside coding of the original page has ended long
before.

Please read up on ASP.

[please do not toppost on usenet]
Resuming, what I need to know if is it possible to interchange ASP and
client JavaScript results.

Example: after the user has pressed submit form and the client
JavaScript has checked all fields I want the result being stored in a
ASP variable, can you understand?

I can understand, and I even told you how to do it.
More extensive:

<form onsubmit='return checkFields()' action='receive.asp' method='post'>
<input name = 'field1'>
<input name = 'field2'>
<input name = 'field3'>
<input type='submit'>
</form>

where the clientside javascript function checkFields()
returns only true when the fields are OK.

==================

And in 'receive.asp':

<%
ValueOfField1 = request.form("field1")
ValueOfField2 = request.form("field2")
ValueOfField3 = request.form("field3")
%>
 
P

Paulo Roberto

I know all that you said... Let me try a example:

In ASP a following code is valid:

<script language=Javascript>
(here comes the codes and we CAN mix asp together, like:)
int someJavaVarInt = <%=aspVariable %>
for i 1 to <%=aspVariableNumber %> do
next
etc etc
</script>

BUT what I need is the INVERSE, just like:

<script language=Javascript>
function JavaScriptClient_Verify(){
...code that checks something and I would like to return TRUE to my asp
variable, something like:
if return(true) then{
<% aspVar = true%>
}
}
</script>

Because on the end of the page I need to execute instructions based on that
aspVariable...

Can you help me ?

Evertjan. said:
Paulo Roberto wrote on 05 sep 2006 in
microsoft.public.inetserver.asp.general:
Evertjan. said:
Paulo Roberto wrote on 05 sep 2006 in
microsoft.public.inetserver.asp.general:

Hi everybody, how r u? I hope fine...

Please write normally this is usenet!

People, I have a Javascript function wich returns true ou false,
how do I assign the result on ASP variable?

I hope you mean serverside Javascript, as clientside Javascript
only executes when the serverside rendering has finisched.

<% blnResult = Javascript:function() %>

<% 'supposing this ids the default vbscript
myResult = myJavascriptFunction()
%>

All these work because I have a form wich fields are verified by
JavaScript on the client...

So it is clientside Javascript?

Is that possible to do?

You will have to send that to the server by a <form> construct,
[or Ajax technology]
because the serverside coding of the original page has ended long
before.

Please read up on ASP.

[please do not toppost on usenet]
Resuming, what I need to know if is it possible to interchange ASP and
client JavaScript results.

Example: after the user has pressed submit form and the client
JavaScript has checked all fields I want the result being stored in a
ASP variable, can you understand?

I can understand, and I even told you how to do it.
More extensive:

<form onsubmit='return checkFields()' action='receive.asp' method='post'>
<input name = 'field1'>
<input name = 'field2'>
<input name = 'field3'>
<input type='submit'>
</form>

where the clientside javascript function checkFields()
returns only true when the fields are OK.

==================

And in 'receive.asp':

<%
ValueOfField1 = request.form("field1")
ValueOfField2 = request.form("field2")
ValueOfField3 = request.form("field3")
%>
 
T

Tim Slattery

Paulo Roberto said:
Sorry Evertjan,

Hi everybody, how are you? I hope fine...

Resuming, what I need to know if is it possible to interchange ASP and
client JavaScript results.

Example: after the user has pressed submit form and the client JavaScript
has checked all fields I want the result being stored in a ASP variable, can
you understand?

Yes, I understand. No it can't be done.

Your ASP code executes on the server. The result is HTML, including
Javascript, which is sent to the client. Any client-side Javascript
executes there after the ASP code is finished.

You can use the Javascript to compute something, which is then
submitted in a form - possibly hidden, probably not - back to the
server.
 
E

Evertjan.

Paulo Roberto wrote on 05 sep 2006 in
microsoft.public.inetserver.asp.general:
Evertjan. said:
Paulo Roberto wrote on 05 sep 2006 in [...]
Please read up on ASP.

[please do not toppost on usenet]

Did you read that?

[please please please please please
please please please please please please
please please please please please
do not toppost on usenet]
I know all that you said...

I do not think so ....
Let me try a example:

In ASP a following code is valid:

<script language=Javascript>
(here comes the codes and we CAN mix asp together, like:)
int someJavaVarInt = <%=aspVariable %>
for i 1 to <%=aspVariableNumber %> do
next
etc etc
</script>

Not true, that is not in ASP,
the shown ASP-vbscript code is just used
to render the clientside javascript code!
and html and clientside code is not ASP.

The client/browser only receives the value!!!

Try is by view-source-ing your page on the browser.
BUT what I need is the INVERSE, just like:
[...]

Impossible, your reasoning is wrong.

Rain stops when conditions in the cloud change,
and the street gets dry,
but you cannot change the conditons in the cloud
by swapping up the rain from the street.

ASP renders a text stream that is sent as
HTML+clientsidecode to the client.
When the clientside code executes on the browser,
the rendering of the serverside ASP code
[usualliy in vbscript or also javascript]
is done and finished.
Because on the end of the page I need to
execute instructions based on that
aspVariable...

You cannot execute serverside(!!!) code based
on something that comes up clientside in the same page.

The client has to sent this to the server
and the server can only process this under ASP
in a newly called asp-file.

This can be done as shown twice using a <form> submit,
[or with Ajax technology,
the latter being far to difficult for you,
if you do not understand the above.]

====

[Sorry, but if you keep on topposting I will not answer anymore.]
 
M

Mike Brind

Client side code runs on the client. ASP runs on the server. The only
way that values get passed between the two is in the Request/Response
cycle - meaning a round trip to the server.

In your first example, <%=aspVariable %>is assigned a value on the
server, so that by the time it reaches the client and the javascript is
executed, it is no longer ASP.

Your second example cannot work in the way you have set out. You will
need to perform a round trip to the server to assign a variable in ASP.
Consequently, you can't put a second lot of ASP at the end of the page
as you alluded to to execute later. It all gets executed at once. You
need to rethink your structure.

--
Mike Brind

Paulo said:
I know all that you said... Let me try a example:

In ASP a following code is valid:

<script language=Javascript>
(here comes the codes and we CAN mix asp together, like:)
int someJavaVarInt = <%=aspVariable %>
for i 1 to <%=aspVariableNumber %> do
next
etc etc
</script>

BUT what I need is the INVERSE, just like:

<script language=Javascript>
function JavaScriptClient_Verify(){
...code that checks something and I would like to return TRUE to my asp
variable, something like:
if return(true) then{
<% aspVar = true%>
}
}
</script>

Because on the end of the page I need to execute instructions based on that
aspVariable...

Can you help me ?

Evertjan. said:
Paulo Roberto wrote on 05 sep 2006 in
microsoft.public.inetserver.asp.general:
Paulo Roberto wrote on 05 sep 2006 in
microsoft.public.inetserver.asp.general:

Hi everybody, how r u? I hope fine...

Please write normally this is usenet!

People, I have a Javascript function wich returns true ou false,
how do I assign the result on ASP variable?

I hope you mean serverside Javascript, as clientside Javascript
only executes when the serverside rendering has finisched.

<% blnResult = Javascript:function() %>

<% 'supposing this ids the default vbscript
myResult = myJavascriptFunction()
%>

All these work because I have a form wich fields are verified by
JavaScript on the client...

So it is clientside Javascript?

Is that possible to do?

You will have to send that to the server by a <form> construct,
[or Ajax technology]
because the serverside coding of the original page has ended long
before.

Please read up on ASP.

[please do not toppost on usenet]
Resuming, what I need to know if is it possible to interchange ASP and
client JavaScript results.

Example: after the user has pressed submit form and the client
JavaScript has checked all fields I want the result being stored in a
ASP variable, can you understand?

I can understand, and I even told you how to do it.
More extensive:

<form onsubmit='return checkFields()' action='receive.asp' method='post'>
<input name = 'field1'>
<input name = 'field2'>
<input name = 'field3'>
<input type='submit'>
</form>

where the clientside javascript function checkFields()
returns only true when the fields are OK.

==================

And in 'receive.asp':

<%
ValueOfField1 = request.form("field1")
ValueOfField2 = request.form("field2")
ValueOfField3 = request.form("field3")
%>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,812
Members
47,357
Latest member
sitele8746

Latest Threads

Top