Solved

Using Flash Submit Button with POST method of ASP form object

Posted on 2002-06-24
8
286 Views
Last Modified: 2007-12-19
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.
0
Comment
Question by:smsaleem
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 19

Assisted Solution

by:webwoman
webwoman earned 20 total points
Comment Utility
Unless you want to alienate people, don't use Flash for ANYTHING that's critical. Not everybody has it, or has the right version, and if they don't, your form is useless.

If you know FOR SURE that everyone who may possibly access this has the right plug-ins, that there won't be any problems, and that you know EXACTLY how to make Flash do what you want, then go ahead.

But Flash is limiting for things like this. And while you can use an image as a submit button, if you want to use Flash to submit anything you're going to have to do it ALL in Flash -- not just part. Flash is a self-contained thing, NOT an image. You submit from Flash, you submit FROM FLASH -- NOT from your form.
0
 
LVL 12

Expert Comment

by:Wouter Boevink
Comment Utility
It's possible to submit a form made in flash, so your flash script could be wrong or your loginverify.asp page.

Can you post some code, and explain how you use the submit from flash.
0
 

Author Comment

by:smsaleem
Comment Utility
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&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; 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.length;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_validateForm.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_validateForm('Password','','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</font> </td>
    </tr>
    <tr align="center">
      <td colspan="2">&nbsp;</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</div>
      </td>
      <td width="59%" bordercolor="0">
        <input type = "password" name="Password" size="20" >
      </td>
    </tr>
    <tr>
      <td colspan = "3">&nbsp;</td>
    </tr>
    <tr>
      <td colspan = "3">
        <div align="center">
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 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</title>
</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.Connection")
conStr = "Provider=SQLOLEDB.1;Persist 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("LoginSuccessful.asp")
end if
%>

</body>
</html>


0
 
LVL 19

Expert Comment

by:webwoman
Comment Utility
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.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 12

Accepted Solution

by:
Wouter Boevink earned 30 total points
Comment Utility
If you want to use flash you have to make the form in flash. Or in flash an action for the button.

Don't know flash to well but if you do this should be no problem.

button onpress url action "javascript:form.submit()"
0
 
LVL 4

Expert Comment

by:Wakie
Comment Utility
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.
0
 

Author Comment

by:smsaleem
Comment Utility
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 ?
0
 
LVL 4

Expert Comment

by:Wakie
Comment Utility
Wise move, thanks for closing your question :)
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now