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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to run ASP and then a VB Script function

Status
Not open for further replies.

NegreteO

Programmer
Apr 23, 2003
54
US
Hi,

I have a page where I need that the submit button performs an ASP code and then it runs a cuople of statements in VBScript. Is this possible? How can I do this?

Hope you can help me
 
what VB script do you want to run you mat be able to do it right in ASP
 
Well maybe I didn't make myself clear

If do some ASP operations when my button is submited (database operations)

but I also need to do some operation such as window.open(..) and window.close (client side operation)

But I only can run one or another
 
You can do both...

for example:

If your inserting a new record to the database and want to confirm this insert to the user with a pop up window then you can do something like this:

SET rs...

blah blah

rs.Open "Insert Into mytable values(field1,field2)", objconn

<script language=Javascript>
window.alert("Record Inserted");
</script>

.....

...

i used a Javascript sample above, you can similarly do a Vbscript code...

-VJ
 
Here's a simple example.
Code:
<%
IF request.Form("flag") <> "" then
	response.Write("Here is some .ASP code executing because the form was submitted<br><br><br>")
	RunClientSide=TRUE
Else
	RunClientSide=FALSE
END IF
%>
<form name="Form1" method="post" action="<%=request.ServerVariables("SCRIPT_NAME")%>">
<input type="text" name="txt1" style="width:200px"><br>
<input type="text" name="txt2" style="width:200px"><br>
<input type="submit" name="btnSubmit" value="Submit">
<input type="hidden" name="flag" value="1">
</form>
<%IF RunClientSide THEN%>
<Script LANGUAGE="VBSCRIPT">
form1.txt1.value="Here is some client-side"
form1.txt2.value="script execution"
alert("Client-side script executed")
</script>
<%End IF%>
 
Thanks a lot

This is really helpful

I really apreciatte it
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top