473,405 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

client side asp within server side asp

JT
im trying to use the following code to log whenever a user clicks through
this particlular message box - however, this currently logs regardless of
whether or not the message box was clicked - im assuming this is because the
server-side code can't see the client side if condition. but how can i set
the varMsgBox variable as a server-side variable?

<!--switch to client-side VBScript to use the MsgBox-->
<script language="VBSCRIPT">
dim varMsgBox
varMsgBox = "0"
varMsgBox = MsgBox ("<%=pop_up_text%>", 16, "Urgent Message")
'log that user clicked through the pop-up message - switch back to
server-side to call function to insert log message into the db
if varMsgBox = "1" then
<% Call dumplogfile("User clicked through the pop-up message: " &
pop_up_text)%>
end if
</script>
Jul 19 '05 #1
5 1731
JT wrote:
im trying to use the following code to log whenever a user clicks
through this particlular message box - however, this currently logs
regardless of whether or not the message box was clicked - im
assuming this is because the server-side code can't see the client
side if condition. but how can i set the varMsgBox variable as a
server-side variable?

You can't. All server-side code runs before client-side code is processed.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #2
JT
but isn't there a way to somehow do it along the lines of what is discussed
in this article?

http://www.aspfaq.com/show.asp?id=2198
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:OW**************@tk2msftngp13.phx.gbl...
JT wrote:
im trying to use the following code to log whenever a user clicks
through this particlular message box - however, this currently logs
regardless of whether or not the message box was clicked - im
assuming this is because the server-side code can't see the client
side if condition. but how can i set the varMsgBox variable as a
server-side variable?

You can't. All server-side code runs before client-side code is processed.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Jul 19 '05 #3
No, because by the time the message box comes up, control has switched to
the client.

Bob Lehmann

"JT" <jt@nospam.com> wrote in message
news:eD**************@TK2MSFTNGP09.phx.gbl...
but isn't there a way to somehow do it along the lines of what is discussed in this article?

http://www.aspfaq.com/show.asp?id=2198
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:OW**************@tk2msftngp13.phx.gbl...
JT wrote:
im trying to use the following code to log whenever a user clicks
through this particlular message box - however, this currently logs
regardless of whether or not the message box was clicked - im
assuming this is because the server-side code can't see the client
side if condition. but how can i set the varMsgBox variable as a
server-side variable?

You can't. All server-side code runs before client-side code is processed.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


Jul 19 '05 #4
No, that article talks about what you've successfully done: cause a
client-side action from from server-side code. It's a one-way street. Data
can only be passed to server-side code via the Request object, which only
exists when the page is initially called.

To do what you want will involve another page.

Bob Barrows

JT wrote:
but isn't there a way to somehow do it along the lines of what is
discussed in this article?

http://www.aspfaq.com/show.asp?id=2198
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:OW**************@tk2msftngp13.phx.gbl...
JT wrote:
im trying to use the following code to log whenever a user clicks
through this particlular message box - however, this currently logs
regardless of whether or not the message box was clicked - im
assuming this is because the server-side code can't see the client
side if condition. but how can i set the varMsgBox variable as a
server-side variable?

You can't. All server-side code runs before client-side code is
processed.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get
a quicker response by posting to the newsgroup.


--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #5
1. With your particular example, will the response from your msgbox ever be
anything but 1? You don't leave the user many options when you have only
"vbOK"

2. Since your usage of VBScript in the browser already indicates you are
into doing things in an unorthodox way (said with a "<g>" of course!), you
could do something like so:

yourpage.asp:

<%
Dim pop_up_text
pop_up_text = "All your base are belong to us"
%>
<img id="x" style="display:none;" />

<script type="text/javascript">
//sorry, I cannot bring myself to use vbscript,

if(confirm('<%=pop_up_text%>')) {
var o = document.getElementById('x');
x.src =
'./process.asp?user=IdentifiedSomehow&m=<%=Server.URL Encode(pop_up_text)%>';
}
</script>

process.asp:

<%
Dim sUser, sMessage, oCDO
sUser = Request.Querystring("user")
sMessage = Request.Querystring("m")
Set oCDO = CreateObject("CDO.Message")
oCDO.From = "yo**@yourdomain.kom"
oCDO.To = "yo*@yourdomain.kom"
oCDO.Subject = "User clicked OK"
oCDO.TextBody = sUser & " clicked OK to a prompt of " & sMessage
oCDO.Send
Set oCDO = Nothing
%>


Ray at work

"JT" <jt@nospam.com> wrote in message
news:eD**************@TK2MSFTNGP09.phx.gbl...
but isn't there a way to somehow do it along the lines of what is
discussed
in this article?

http://www.aspfaq.com/show.asp?id=2198
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:OW**************@tk2msftngp13.phx.gbl...
JT wrote:
> im trying to use the following code to log whenever a user clicks
> through this particlular message box - however, this currently logs
> regardless of whether or not the message box was clicked - im
> assuming this is because the server-side code can't see the client
> side if condition. but how can i set the varMsgBox variable as a
> server-side variable?
>

You can't. All server-side code runs before client-side code is
processed.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Tom Leylan | last post by:
(I posted this in languages.vb also... I can't figure out where things go if you use a little of a lot of things) Hi all... I'm looking for an example (or a pointer to one) related to the...
2
by: Dicky Cheng | last post by:
Hi, I am using .net remoting technology. I set up a .net remoting client and server in IIS. When the client calls the server, the server will run a long duration method (30-60seconds). I have a...
18
by: cjl | last post by:
Hey all: I know that it is silly in the age of Google to 'lose' something on the internet, but I recently checked out a project that had implemented a database with a subset of SQL in pure...
5
by: KathyB | last post by:
If someone could just explain this to me...I just don't get it! I have an aspx page where I retrieve several session variables and use xmlDocument to transform xml file with xsl file into an...
11
by: Timothy Shih | last post by:
Hi, I am having a freezing issue with my application. My application serves several remotable objects, all of which must be initialized before their use. Furthermore, some of them depend on each...
3
by: Ken Allen | last post by:
I am relatively new to .Net and C#, but I hav ebeen programing in other languages and done some COM work for a number of years. I am attempting to understand how to map an older program...
8
by: Mike Fellows | last post by:
Ok, im not sure if this is at all possible and if it is how i go about it is beyond me i have a piece of client side code that requires a piece of data from the server side (an ID number in this...
2
by: Guadala Harry | last post by:
In an aspx file I have declared a hidden field like this: <input id="hTestVal" type=hidden value="-1" runat="server"> Defined in the code-behind like this: protected...
5
by: Ankur | last post by:
Hi Folks, I am new for this group. I want to clarify one thing what's a basic difference between Client Side Java Script and Server Side Java Script. how we can differentiate it. Why we called...
5
by: Simon | last post by:
I heard that we could do that by using AJAX. Could anybody share how to do it? Thanks.
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.