FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Working with Swift Forms?
#1
Hi, stumbled across this and think it's a great idea! I installed Form Tools on my server and everything seems to work OK, except I have a form created in Flash that is now a SWF file. Does Form Tools work with swf files?

Thanks
Reply
#2
Heya,

Sure! Form Tools works with any type of form - anything that can submit a standardized HTTP POST request. Smile

You pretty much follow the exact instructions available in the documentation and Add Form process, except instead of adding the hidden form_tools_form_id and form_tools_initialize_form fields to your HTML form, you'd just add them to the object / hash being submitted via actionscript. That's the general idea.

Anyway, good luck!

- Ben
Reply
#3
Ben,

Could you please explain how to integrate Form Tools 2.0.2 into Flash? Below is my HTML code for my index.html page that holds the Flash file.

<object id="FlashID" classid="clsidBig Grin27CDB6E-AE6D-11cf-96B8-444553540000" width="980" height="750" />
<param name="movie" value="site.swf">
<param name="quality" value="high">
<param name="wmode" value="transparent">
<param name="swfversion" value="8.0.35.0">
<param action="http://domain.com/secure/process.php" method="post">
<param type="hidden" name="form_tools_initialize_form" value="1" />
<param type="hidden" name="form_tools_form_id" value="66" />
<!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
<param name="expressinstall" value="../Scripts/expressInstall.swf">
<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="site.swf" width="980" height="750">
<!--<![endif]-->
<param name="quality" value="high">
<param name="wmode" value="transparent">
<param name="swfversion" value="8.0.35.0">
<param name="expressinstall" value="../Scripts/expressInstall.swf">
<!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
<div>
<h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
</div>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
<script type="text/javascript">
<!--
swfobject.registerObject("FlashID");
//-->
</script>

<div id="footerlogo" style="margin-left:800px;" ><a href="http://domain.com" target="_blank">Powered by Company</a></div>

<script type="text/javascript">
var so = new SWFObject("footer.swf", "mymovie", "175", "23", "9", "#000000");
so.addParam("wmode", "transparent");
so.write("footerlogo");
</script>


Then here is my ActionScript code in AS 2.0.

stop ();
System.useCodepage = true;
send_btn.onRelease = function ()
{
submittedData = new LoadVars();
submittedData.action = "POST";
submittedData.name = name_box.text;
submittedData.sender = email_box.text;
submittedData.subject = phone_box.text;
submittedData.message = message_box.text;
submittedData.form_tools_initialize_form = 1;
submittedData.form_tools_form_id = 66;
if (submittedData.name != "" && submittedData.sender != "" && submittedData.subject != "" && submittedData.message != "")
{
submittedData.sendAndLoad("http://www.domain.com/secure/process.php", submittedData, "POST");
gotoAndStop(2);
}
else
{
error_clip.gotoAndPlay(2);
} // end else if
submittedData.onLoad = function ()
{
gotoAndStop(3);
};
};
name_box.onSetFocus = email_box.onSetFocus = phone_box.onSetFocus = message_box.onSetFocus = function ()
{
if (error_clip._currentframe != 1)
{
error_clip.gotoAndPlay(6);
} // end if
};


FIRST
- I am unable to register this form with Form Tools using the Add Form process. What do I need to do to get it registered and also does my code above look correct for ActionScript 2.0 and HTML?

Thanks,
Diesel
Reply
#4
Hey Diesel,

Troubleshooting Flash is always a little tricky. Smile

If Form Tools can't get the test submission, it's due to one (or both!) of these causes:
1. The POST request just isn't getting there
2. The POST request isn't containing the info that it's expecting

For #1, do you have Firebug installed? If not, get it! And temporarily switch over to Firefox while you're working on this if you're not already using it. Firebug has a handy "Net" panel that shows all requests and responses going on behind the scenes. For Ajax and Flash work, this is an absolute life-saver. Check that the request is in fact being sent.

Secondly, I believe sendAndLoad will require you to have added a "cross domain" file on your site. Sending data via a form submit is no problem with Flash - but to get the response (the ...AndLoad bit), you need the cross domain file. That file just says "sure, allow this particular site to read content from this location". Here's an example of how to create the file:
http://curtismorley.com/2007/09/01/flash...nxml-file/

For #2 above, judging from what you posted it looks okay.

Let me know how it goes!

- Ben
Reply
#5
Hey Diesel

i dont know if this is what your looking for but, done this a while ago and worked like a charm and stopped using it,.. the flash file attached with fla source, they are done in really old way and beginner's , it was 4 years ago SORRY !! i just removed some text and changed some cause it had some text of the client and company details.

Functionally its working fine, all you have to is define the process code in the second frame and form ID in the first frame.

form_tools_form_id = "X";
change the X to your form ID


to add the initialize line, to test it only the first time, after your done remove it ..
form_tools_initialize_form="1";

i hope i helped ..
Regards Smile


Attached Files
.zip   FLASH FORM.zip (Size: 219.22 KB / Downloads: 5)
Reply
#6
(Sep 5th, 2010, 6:09 AM)uaenoob Wrote: Hey Diesel

i dont know if this is what your looking for but, done this a while ago and worked like a charm and stopped using it,.. the flash file attached with fla source, they are done in really old way and beginner's , it was 4 years ago SORRY !! i just removed some text and changed some cause it had some text of the client and company details.

Functionally its working fine, all you have to is define the process code in the second frame and form ID in the first frame.

form_tools_form_id = "X";
change the X to your form ID


to add the initialize line, to test it only the first time, after your done remove it ..
form_tools_initialize_form="1";

i hope i helped ..
Regards Smile


Thank you very much for your help. I have uploaded the files, changed the process code location, the form ID, and added the initialize for setting up the form. The problem I'm running into is Form Tools 2.0.2 when I get to the Test Submission step, I fill out the form, submit, but Form Tools never sees it submit, so I can't get past the Test Submission stage.

Any ideas why it's not working? Below is the only code I adjusted.

Frame 1

stop();
Stage.showMenu = false;
form_tools_initialize_form = "1";
form_tools_form_id = "66";

// Making the Default Settings
valuebox = ""
companyname = "";
building = "";
pobox = "";
tel = "";
officeno = "";
area = "";
fax = "";
tel1 = "";
tel2 = "";
fax1 = "";
fax2 = "";
website = "";
license = "";
nameofcontact = "";
contactposition = "";
mobile = "";
email = "";
managingname = "";
valuebox1 = "";
valuebox2 = "";
valuebox3 = "";
valuebox4 = "";
valuebox5 = "";
valuebox6 = "";
question1 = "";
other = "";
//
//-------------------------------------------------------
// Apply Button
apply.onRelease = function() {
valuebox = (valuebox1+valuebox2+valuebox3+valuebox4+valuebox5)
about = (radiobtn1+radiobtn2+radiobtn3+radiobtn4+radiobtn5+radiobtn6+radiobtn7+radiobtn8+radiobtn9+radiobtn10+radiobtn11+radiobtn12+radiobtn13+radiobtn14+radiobtn15+radiobtn16+other);
required._visible = true;
//
str1 = email.indexOf("@");
str2 = email.indexOf("@")+1;
str3 = email.charAt(str1+1);
str4 = email.lastIndexOf(".");
str5 = email.charAt(str4+1);
len = length(email);
counter = 1;
flag = 0;
while (Number(counter)<=Number(len)) {
Char = substring(email, counter, 1);
if (Char ne "@") {
flag = Number(flag)+1;
}
counter = Number(counter)+1;
}
//
//companyname validation
if (companyname == "") {
condition1 = "";
companynamemark._visible = true;
} else {
condition1 = "ok";
companynamemark._visible = false;
}
//building validation
if (building == "") {
condition2 = "";
buildingmark._visible = true;
} else {
condition2 = "ok";
buildingmark._visible = false;
}
//pobox validation
if (pobox == "") {
condition3 = "";
poboxmark._visible = true;
} else {
condition3 = "ok";
poboxmark._visible = false;
}
//tel validation
if (tel2 == "") {
condition4 = "";
telmark._visible = true;
} else {
condition4 = "ok";
telmark._visible = false;
}
//officeno validation
if (officeno == "") {
condition5 = "";
officenomark._visible = true;
} else {
condition5 = "ok";
officenomark._visible = false;
}
//area validation
if (area == "") {
condition6 = "";
areamark._visible = true;
} else {
condition6 = "ok";
areamark._visible = false;
}
//emirate validation
if (emiratebox.selectedItem.label == "Choose") {
condition7 = "";
emiratemark._visible = true;
} else {
condition7 = "ok";
emiratemark._visible = false;
}
//fax validation
if (fax2 == "") {
condition8 = "";
faxmark._visible = true;
} else {
condition8 = "ok";
faxmark._visible = false;
}
//businessactivity validation
if (businessactivitybox.selectedItem.label == "Choose") {
condition9 = "";
businessactivitymark._visible = true;
} else {
condition9 = "ok";
businessactivitymark._visible = false;
}
//license validation
if (license == "") {
condition10 = "";
licensemark._visible = true;
} else {
condition10 = "ok";
licensemark._visible = false;
}
//staffnumber validation
if (staffnumberbox.selectedItem.label == "Choose") {
condition11 = "";
staffnumbermark._visible = true;
} else {
condition11 = "ok";
staffnumbermark._visible = false;
}
//income validation
if (incomebox.selectedItem.label == "Choose") {
condition12 = "";
incomemark._visible = true;
} else {
condition12 = "ok";
incomemark._visible = false;
}
//profit validation
if (profitbox.selectedItem.label == "Choose") {
condition13 = "";
profitmark._visible = true;
} else {
condition13 = "ok";
profitmark._visible = false;
}
//nameofcontact validation
if (nameofcontact == "") {
condition14 = "";
nameofcontactmark._visible = true;
} else {
condition14 = "ok";
nameofcontactmark._visible = false;
}
//contactposition validation
if (contactposition == "") {
condition15 = "";
contactpositionmark._visible = true;
} else {
condition15 = "ok";
contactpositionmark._visible = false;
}
//mobile validation
if (mobile == "") {
condition16 = "";
mobilemark._visible = true;
} else {
condition16 = "ok";
mobilemark._visible = false;
}
//managingname validation
if (managingname == "") {
condition17 = "";
managingnamemark._visible = true;
} else {
condition17 = "ok";
managingnamemark._visible = false;
}
//question1 validation
if (question1 == "") {
condition18 = "";
question1mark._visible = true;
} else {
condition18 = "ok";
question1mark._visible = false;
}
//E-Mail Address validation
if (str4<=str2 || str3 == "." || str5 == "" || Number(flag) != Number(len-1)) {
condition19 = "";
emailmark._visible = true;
} else {
condition19 = "ok";
emailmark._visible = false;
}
//Catogries validation
if (valuebox == "") {
condition20 = "";
catreq._visible = true;
checkboxes._visible = true;
} else {
condition20 = "ok";
catreq._visible = false;
checkboxes._visible = false;
}
//Sending Data 2 PHP
if (condition1 == "ok" && condition2 == "ok" && condition3 == "ok" && condition4 == "ok" && condition5 == "ok" && condition6 == "ok" && condition7 == "ok" && condition8 == "ok" && condition9 == "ok" && condition10 == "ok" && condition11 == "ok" && condition12 == "ok" && condition13 == "ok" && condition14 == "ok" && condition15 == "ok" && condition16 == "ok" && condition17 == "ok" && condition18 == "ok" && condition19 == "ok" && condition20 == "ok") {
gotoAndStop(2);
}
};


Frame 2 (Obviously the * I inserted my domain.)

tel = tel1 + " - " + tel2;
fax = fax1 + " - " + fax2;
loadVariablesNum("http://********.com/secure/process.php", 0, "POST");
loadVariablesNum(feedbackpath+"?companyname="+companyname+"&building="+building+"&pobox="+pobox+"&tel="+tel+"&officeno="+officeno+"&area="+area+"&emirate="+emirate+"&fax="+fax+"&website="+website+"&businessactivity="+businessactivity+"&license="+license+"&staffnumber="+staffnumber+"&income="+income+"&profit="+profit+"&nameofcontact="+nameofcontact+"&contactposition="+contactposition+"&mobile="+mobile+"&email="+email+"&managingname="+managingname+"&valuebox="+valuebox+"&question1="+question1+"&about="+about, 0);
stop();
Reply
#7
Hey, works fine with me

First of all i think you did the editing of the FLA file .. which is correct

My Config

form_tools_initialize_form = "1";
form_tools_form_id = "1";
loadVariablesNum("http://localhost:8888/form/process.php", 0, "POST");


Maybe i didn't mention that you have to embed the SWF file in a PHP file .. not HTML

Then after verifying link it will ask to test.. you have to choose direct
   
you go to the php form link which has the flash form in it, insert every field then submit ..

After that go back to form tools page and hit refresh !
   
i attached every screenshot to show you it works !!
   
just tested it 5 mins ago, same files i gave you Smile

i even attached the php


Attached Files
.php   form.php (Size: 867 bytes / Downloads: 2)
Reply
#8
uaenoob,

Thank you for the clarification and the file. I have now narrowed down my problem to cross browser issues regarding Flash. Back in Form Tools 1.5 I had an XML file that contained:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="www.mydomain.com" />
</cross-domain-policy>

I placed this in the root of my server where my form tools is installed. When I ran a test with the form on my server that had form tools it worked perfectly. When I move the form to a different domain it stops working. Any idea what cross domain code I might need and where it should be placed?

Thanks,
Diesel
Reply
#9
hey diesel

my knowledge in crossing domains isn't that good but i might help little bit

i have 2 solutions and hopefully one of them will do the work

First Try this

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="domain1.com"/>
<allow-access-from domain="*.domain1.com"/>
<allow-access-from domain="www.domain1.com"/>
<allow-access-from domain="domain2.com"/>
<allow-access-from domain="*.domain2.com"/>
<allow-access-from domain="www.domain2.com"/>
<allow-access-from domain="domain3.com"/>
<allow-access-from domain="*.domain3.com"/>
<allow-access-from domain="www.domain3.com"/>
</cross-domain-policy>

by changing the domain1, domain2, domain3 to the ones you want..


Second, but this one isn't recommended

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" secure="false"/>
</cross-domain-policy>

you have to put the the crossdomain.xml in the root .. of your website

Hope i helped

Regards
uaenoob
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)