If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Not sure what to call it

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-04-04, 09:09
breeze76 breeze76 is offline
Registered User
 
Join Date: Apr 2004
Posts: 75
Question Not sure what to call it

How do you get the message box or whatever it is call to popup? You know like if you are closing a page and the yes/no pops up. what is that called and what would the code be to make one come up?

This is an error code I would like to have it pop for:

re.Pattern = "^\d{3}-\d{3}-\d{4}$"
errorArray(2) = re.Test(phone_number)
if errorArray(2) then
errorArray(2) = False
else
errorArray(2) = True
ErrorMsg = ErrorMsg & "Telephone Number<br>"
end if

breeze76

Last edited by breeze76; 05-04-04 at 09:14.
Reply With Quote
  #2 (permalink)  
Old 05-04-04, 13:25
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
That would be a modal dialog box...

Code:
<%
re.Pattern = "^\d{3}-\d{3}-\d{4}$"
errorArray(2) = re.Test(phone_number)
if errorArray(2) then
  errorArray(2) = False
else
  errorArray(2) = True
  ErrorMsg = ErrorMsg & "Telephone Number<br>"
end if
%>
<script language="JavaScript">
<!--
//Simple "Ok" prompt
alert("<%=ErrorMsg%>");

//Confirmation Yes/No Prompt
confirm("<%=ErrorMsg%>");

//Use confirm message in an If statement
if( confirm("<%=ErrorMsg%>") ){
  //Yes was clicked - do something
}
else{
  // No was clicked - do something else
}
//-->
</script>
__________________
That which does not kill me postpones the inevitable.

Last edited by Seppuku; 05-04-04 at 15:02.
Reply With Quote
  #3 (permalink)  
Old 05-04-04, 23:25
breeze76 breeze76 is offline
Registered User
 
Join Date: Apr 2004
Posts: 75
Ok I used this one here:

alert("<%=ErrorMsg%>");

I works fine but my only problem is that I have four or five errors that can be included at one time. They do not all fit in the message box... how would I code it so that if none of the required fields are entered, up to 4 or 5 they will all show and could be read easily?

Thanks for the code though, it does do the job.

breeze76
Reply With Quote
  #4 (permalink)  
Old 05-05-04, 01:21
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
At the end of each message, include a \n. This will put a newline character at the end, and start the next error on the next line.

Code:
<%
  Dim ErrorMsg
  ErrorMsg = "1) This is an error message\n\n"
  ErrorMsg = ErrorMsg & "2) A second error message\n\n"
  ErrorMsg = ErrorMsg & "3) A third error message"
%>

<script language="JavaScript">
<!--
alert(<%=ErrorMsg%>);
//-->
</script>
This will make an error box pop up with the message formatted like:
Code:
 
1) This is an error message

2) A second error message

3) A third error message
Or you could get fancy and make an html error popup. This way you can make nicely designed error pages.
Code:
<%
  Dim ErrorMsg
  ErrorMsg = "1,2,3"
%>

<script language="JavaScript">
<!--
window.open("errormsg.asp?ErrorMsgID=<%=ErrorMsg%>", "ErrorMsgWin", "height=300,width=300");
//-->
</script>
ErrorMsg.asp:
Code:
<html><body>
<%
  Dim aErrorMsgs()
  Dim aErrorArray

  ReDim aErrorMsgs(3)
  aErrorMsgs(0) = "This is message 1."
  aErrorMsgs(1) = "This is message 2."
  aErrorMsgs(2) = "This is message 3."

  aErrorArray = Split(Trim(Request.QueryString("ErrorMsgID")), ",")

  Dim x
  For x = 0 To UBound(aErrorArray)
    Response.Write aErrorMsgs(aErrorArray(x)) & "<BR>"
  Next
%>
</body></html>
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On