I have written some code for validating user input.
A javascript prompt window takes the user input and passes it as part of the
querystring to a second asp page that uses the command object to run a stored
procedure that validates the user's input i.e. it checks whether the data
exists in the database. The second asp page then uses javascript to close the
page after it has sent a response to the first page.
My code works fine. However, the second window flashes up on the screen before
closing. Is there any way I can open the asp page without the window opening?
The relevant extracts of my code are as follows...
javascript from first page:
function fMoveStent(varDesk)
{
var deskTo = prompt("Please enter the Desk number to where this stent
will move.", "Type full desk number e.g. 'CS0204A01' here");
fValidateToDesk(deskTo);
}
function fValidateToDesk(desk)
{
window.open("validDesk.asp?desk=" + desk);
}
function fValidatedDesk(desk)
{
alert("this function is working and the desk is " + desk);
}
function fInvalidDesk(desk)
{
alert("Sorry, that desk number you entered - " + desk + " - is not valid.
\n Please check and try again with the correct, FULL desk number");
}
</script>
***********************************************
code from second page
set objConn = Server.CreateObject("ADODB.Connection")
Set objCmd = server.CreateObject("ADODB.Command")
objConn.Open strSQLconn
Set objCmd.ActiveConnection = objConn
objCmd.CommandType = 4
objCmd.CommandText = "procStentDeskValid"
objCmd.Parameters(1) = Request("desk")
objCmd.Execute
iReturn = objCmd.Parameters(0)
If iReturn = 0 then ' there is no such desk
strFunction = "fInvalidDesk();"
Else
strFunction = "fValid();"
End If
%>
<script type="text/javascript" language="javascript">
function fValid()
{
self.opener.fValidatedDesk('<%=Request("desk")%>')
}
function fInvalidDesk()
{
self.opener.fInvalidDesk('<%=Request("desk")%>')
}
</script>
<html>
<body onload="<%=strFunction%>">
</body>
</html>
[Non-text portions of this message have been removed]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/