Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Message Box

Status
Not open for further replies.

jedel

Programmer
Jan 11, 2003
430
AU
Hey all,

If wasted the entire morning trying to find the correct way of writing a simple message box.

All I want to do is check to see if a recordset has data in it and if so pop up a message box with a statement.

I've started with something like
Code:
<%if Recordset<>EOF then
[Messagebox code]
Else
[proceed with process]
End if%>

Can anybody show me the correct way of writing this or point me to a place where I can see how this is done?

I don't want to go to a redirect page, just a message box.

Thanks


-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."
 
><%if Recordset<>EOF then
What is it, Recordset<>EOF?

One way is to add the window.onload handler containing an alert to send the message, or add that alert to the existing onload handler.
[tt]
<% If not Recordset.EOF Then %>
<script>window.onload=function() {alert("message");}</script>
<% else
'[proceed with process]
End If %>[/tt]
 
I need to the message to alert with an on click event.
ie
if there are child records present, show the message else delete the parent record

-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."
 
You take a lot for granted. What communication between client and server are you talking about?
 
I apologise,

I though I was is the ASP forums and it was assumed. obviousl ASP, I use VBScipt mostly. and the connection is OLEDB either DSN-less or via DSN. in this case its a DSN

-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."
 
What do you mean by communication between client and server? Please give me an example

-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."
 
ASP is a server side technology - everything happens before any data is served to the client. If you want this action triggered from client side you will need to use a client side technology like Javascript. It's not very clear from your question what action you want to happen, and what is supposed to trigger it.

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Does it need to be a pop up type box, or could it just be displayed in the page?
Maybe this would be helpful:

Code:
rs.Open SQL, data_source

If rs.Eof Then 
Response.write "<div class='alert'><p>Sorry there are no current records or whatever you want to say.</p></div>" 
Else 
whatever you want to do

I think Tsuji and John are trying to say that generally, as I'm sure one would be aware if one thought about it, the more info one posts in terms of exactly what one is trying to do, what one has tried (especially), what one is using, etc, the easier it is for people to help.

 
I really don't care if it was done client side or server side. The aim is for a messagebox, not a redirect page or div popup to appear on an onclick event after checking to see of a recorset is empty.

I'm sure I covered the gist of this in my first post. I think you may be getting confused at my example in the first post. It is only what I tried. It obviously didn't work.

If you know how (Client side OR server side) to make this happen, I'd really appreciate the help.

At the moment, I'm running an if then statement usin ASP to bring up another page. Here is the code that I'm using at the moment.

Code:
<% If CMbrs.EOF Then %>
      <a href="CgroupsDel.asp?<%= Server.HTMLEncode(MM_keepURL) %>">DELETE THIS CONNECT GROUP</a>
<%Else%>
      <a href="CMbrMsg.asp" onclick="NewWindow(this.href,'name','400','430','yes');return false">DELETE THIS CONNECT GROUP</a>
      
      <%End If%>

Now this works, but I want a message box to appear rather than using another page. As I said earlier, I really don't care if the code above is modified or completely replaced.

I'm sorry if this wasn't clear earlier, I thought I gave enough information to portray what I was trying to learn. I didn't think it was going to be such a big undertaking

-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."
 
this is what you need, based on what you have stated:
<%if Recordset<>EOF then %>
<script type="text/javascript">
alert ( "this is a pop up msg!" );
</script>
<%end if %>
you don't need an else, that's the default.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top