Solved

Using Flash Submit Button with POST method of ASP form object

Posted on 2002-06-24
8
294 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
ID: 7103897
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
ID: 7106748
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
ID: 7106953
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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 19

Expert Comment

by:webwoman
ID: 7107491
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
 
LVL 12

Accepted Solution

by:
Wouter Boevink earned 30 total points
ID: 7108062
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
ID: 9355486
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
ID: 9356305
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
ID: 9359350
Wise move, thanks for closing your question :)
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ASP Sessions Being Cleared/Modified 6 80
EOF BOF error classic asp 8 48
Adding Datediff to staistics page 2 56
JS does not refresh 6 20
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
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/…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

809 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