smsaleem
asked on
Using Flash Submit Button with POST method of ASP form object
Hi everybody!
I am working on ASP 3.0 with VBScript at backend for communication with SQL Server 2000. The HTML scripting tool that I am using is Dreamweaver MX.
My login submit form, i.e. "Login.asp", has two text boxes, "LoginName" and "Password". I want to post these fields to "LoginVerify.asp" which communicates with the SQL Server using:
conn.open strConnect, LoginName, Passowrd
When I use "Login.asp" form object's submit button the information is posted to the "LoginVerify.asp" but when I use Flash Button as a Submit button the information is not posted to "LoginVerify.asp".
Is there any way to use Flash (Dreamweaver MX) button as submit button? The Flash button in Dreamweaver MX seems to accepts databounnd fields only.
I am working on ASP 3.0 with VBScript at backend for communication with SQL Server 2000. The HTML scripting tool that I am using is Dreamweaver MX.
My login submit form, i.e. "Login.asp", has two text boxes, "LoginName" and "Password". I want to post these fields to "LoginVerify.asp" which communicates with the SQL Server using:
conn.open strConnect, LoginName, Passowrd
When I use "Login.asp" form object's submit button the information is posted to the "LoginVerify.asp" but when I use Flash Button as a Submit button the information is not posted to "LoginVerify.asp".
Is there any way to use Flash (Dreamweaver MX) button as submit button? The Flash button in Dreamweaver MX seems to accepts databounnd fields only.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am not using Flash form. I am trying to use Flash Button on ASP form. Here is the code of submit from. The JavaScript has been generated by DreamweaverMX.
__________________________ __________ __________ __________
<html>
<head>
<title>Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&p arent.fram es.length) {
d=parent.frames[n.substrin g(p+1)].do cument; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length; i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d. layers.len gth;i++) x=MM_findObj(n,d.layers[i] .document) ;
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max, errors='', args=MM_va lidateForm .arguments ;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!= -1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
</head>
<body>
<form action="LoginVerify.asp" method="post" name="form1" onSubmit="button2.swf;MM_v alidateFor m('Passwor d','','R') ;return document.MM_returnValue">
<div align="center"></div>
<table width="72%" border="0">
<tr align="center">
<td colspan="2"><font size="4" color="#07A9D8">Login</fon t> </td>
</tr>
<tr align="center">
<td colspan="2"> </td>
</tr>
<tr>
<td width="41%">
<div align="right">Login Name</div>
</td>
<td width="59%">
<input type="text" name="LoginName" size="20">
</td>
</tr>
<tr>
<td width="41%">
<div align="right">Password</di v>
</td>
<td width="59%" bordercolor="0">
<input type = "password" name="Password" size="20" >
</td>
</tr>
<tr>
<td colspan = "3"> </td>
</tr>
<tr>
<td colspan = "3">
<div align="center">
<object classid="clsid:D27CDB6E-AE 6D-11cf-96 B8-4445535 40000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" name="Button2" width="100" height="20" id="Button2">
<param name="BASE" value=".">
<param name="BGCOLOR" value="">
<param name="movie" value="button2.swf">
<param name="quality" value="high">
<embed src="button2.swf" width="100" height="20" base="." quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" onsubmit="" name="Button2" loginname="LoginName" password="Password" ></embed></object>
</div>
</td>
</tr>
<tr>
<td colspan = "3">
<div align="center">
<input type="submit" name="Login" value="Login" >
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
The following is "LoginVerify.asp"
__________________________ __________ __________ ________
<%@ LANGUAGE = VBScript %>
<% option explicit %>
<% Response.Buffer = TRUE %>
<% on error resume next %>
<html>
<head>
<title>LoginValidate</titl e>
</head>
<body>
<%
Dim strLoginName, strPassword
Dim objConn, objRs, conStr, query
dim source
strLoginName = Request.Form("LoginName")
strPassword = Request.Form("Password")
set objConn = Server.CreateObject("ADODB .Connectio n")
conStr = "Provider=SQLOLEDB.1;Persi st Security Info=False;Initial Catalog=MyCatalog;Data Source=MyComputer"
Set objRS = Server.CreateObject("ADODB .Recordset ")
objConn.Open conStr, strLoginName, strPassword
objRs.Open "Select * from Guest", objConn
if objRs.EOF then
objRs.Close
objConn.Close
Response.Redirect "LoginFailure.asp"
else
response.Redirect("LoginSu ccessful.a sp")
end if
%>
</body>
</html>
__________________________
<html>
<head>
<title>Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&p
d=parent.frames[n.substrin
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;
for(i=0;!x&&d.layers&&i<d.
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
</head>
<body>
<form action="LoginVerify.asp" method="post" name="form1" onSubmit="button2.swf;MM_v
<div align="center"></div>
<table width="72%" border="0">
<tr align="center">
<td colspan="2"><font size="4" color="#07A9D8">Login</fon
</tr>
<tr align="center">
<td colspan="2"> </td>
</tr>
<tr>
<td width="41%">
<div align="right">Login Name</div>
</td>
<td width="59%">
<input type="text" name="LoginName" size="20">
</td>
</tr>
<tr>
<td width="41%">
<div align="right">Password</di
</td>
<td width="59%" bordercolor="0">
<input type = "password" name="Password" size="20" >
</td>
</tr>
<tr>
<td colspan = "3"> </td>
</tr>
<tr>
<td colspan = "3">
<div align="center">
<object classid="clsid:D27CDB6E-AE
<param name="BASE" value=".">
<param name="BGCOLOR" value="">
<param name="movie" value="button2.swf">
<param name="quality" value="high">
<embed src="button2.swf" width="100" height="20" base="." quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" onsubmit="" name="Button2" loginname="LoginName" password="Password" ></embed></object>
</div>
</td>
</tr>
<tr>
<td colspan = "3">
<div align="center">
<input type="submit" name="Login" value="Login" >
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
The following is "LoginVerify.asp"
__________________________
<%@ LANGUAGE = VBScript %>
<% option explicit %>
<% Response.Buffer = TRUE %>
<% on error resume next %>
<html>
<head>
<title>LoginValidate</titl
</head>
<body>
<%
Dim strLoginName, strPassword
Dim objConn, objRs, conStr, query
dim source
strLoginName = Request.Form("LoginName")
strPassword = Request.Form("Password")
set objConn = Server.CreateObject("ADODB
conStr = "Provider=SQLOLEDB.1;Persi
Set objRS = Server.CreateObject("ADODB
objConn.Open conStr, strLoginName, strPassword
objRs.Open "Select * from Guest", objConn
if objRs.EOF then
objRs.Close
objConn.Close
Response.Redirect "LoginFailure.asp"
else
response.Redirect("LoginSu
end if
%>
</body>
</html>
Don't use a Flash button. You can't use Flash as a submit button. You can use a GRAPHIC, but not an OBJECT. Not the same thing at all.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It appears this question has been abandoned.
I will leave a recommendation in the Cleanup topic area that this question will be:
- Points to wboevink -
Please leave any comments here within the next seven days.
DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Wakie,
EE Cleanup Volunteer.
I will leave a recommendation in the Cleanup topic area that this question will be:
- Points to wboevink -
Please leave any comments here within the next seven days.
DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Wakie,
EE Cleanup Volunteer.
ASKER
Thanks Wakie for your suggestion.
When the question was asked, i remember, there was no provision of point splitting. Both webwoman and wboevink did not solve the problem, but they did their best. I regard both of them high - webwoman for her experienced advice, and wboevink for his understanding to problem.
Their answers were partial, so awarding any point to any individual only, was not justified. Now that point splitting is available, i suggest this point division for the effort that they made :)
Wakie any comment ?
When the question was asked, i remember, there was no provision of point splitting. Both webwoman and wboevink did not solve the problem, but they did their best. I regard both of them high - webwoman for her experienced advice, and wboevink for his understanding to problem.
Their answers were partial, so awarding any point to any individual only, was not justified. Now that point splitting is available, i suggest this point division for the effort that they made :)
Wakie any comment ?
Wise move, thanks for closing your question :)
Can you post some code, and explain how you use the submit from flash.