...

View Full Version : Embed Form ID into Flash



Divinem7
07-22-2009, 08:22 PM
I'm a web designer for a large nonprofit and I'm currently trying to test an email submission form we want to embed in a Flash Advertisement. Basically we will be placing our Flash ad on a large website and I just wanted to make sure a quick email signup was possible. I've used the guildelines outlined from tutorials like this one (http://www.tizag.com/flashTutorial/flashforms.php) but have run into the problem that our Form Data Processor page (http://www2.aspca.org/site/Survey) needs a Form Id to be specified so it knows which survey to post the results to. In HTML, the form looks like this.

<form name="survey_11460" id="survey_11460" method="POST" action="http://www2.aspca.org/site/Survey" >

<table border="0" cellspacing="0" cellpadding="0">
<tr valign="top">


<td width="5%" class="req" align="right" nowrap="nowrap">
&nbsp;
</td>

<td>
<span class="Explicit">Your Info:</span><br />



<table border="0" cellspacing="4" cellpadding="0">

<tr style="position:absolute;left:-9999px">
<td colspan="3">
<input type="hidden" name="cons_info_component" id="cons_info_component" value="t" />
</td>
</tr>
<tr>
<td width="1%">

<p>*</p>

</td>
<td nowrap="nowrap">
<p><label for="cons_email">Email: <span style="position:absolute;left:-9999px">Required</span></label></p>

</td>
<td>
<input type="text" name="cons_email" id="cons_email" value=""
size="32"
maxlength="255" />
</td>
</tr>
<tr>
<td width="1%">
<p>&nbsp;</p>
</td>
<td colspan="2">
<input type="hidden" name="cons_mail_opt_in" id="cons_mail_opt_in" value="t" />
<input type="checkbox" name="cons_email_opt_in" id="cons_email_opt_in" checked="checked" />

<label for="cons_email_opt_in" class="wrapable">
<span class="Explicit">Yes, I would like to receive updates about important animal cruelty and pet care news.</span></label>
<input type="hidden" id="cons_email_opt_in_requested" name="cons_email_opt_in_requested" value="true" />
</td>
</tr>
<tr>
<td width="1%">
<p>&nbsp;</p>
</td>
<td colspan="2">
<input type="checkbox" name="s_rememberMe" id="s_rememberMe" checked="checked" />

<label for="s_rememberMe" class="wrapable">
<span class="Explicit">Remember me. <script> document.write('<a class="Smaller" title="View Privacy Policy (opens new window)" href="'); document.write("javascript:MM_openBrWindow('http://www2.aspca.org/site/PageServer?pagename=whatsthis&printer_friendly=1','Description','toolbar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes,dependen t=yes,width=700,height=500')"); document.write('">What\'s this?</a>'); </script> <noscript> <a class="Smaller" href="http://www2.aspca.org/site/PageServer?pagename=whatsthis&printer_friendly=1" title="View Privacy Policy (opens new window)" target="_blank" >What's this?</a> </noscript> </span>
</label>

<a class="Smaller" title="View Privacy Policy (opens new window)"
onclick="javascript:MM_openBrWindow('http://www2.aspca.org/site/PageServer?pagename=privacypolicy&printer_friendly=1','Description','toolbar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes,dependen t=yes,width=700,height=500'); return false;"
href="http://www2.aspca.org/site/PageServer?pagename=privacypolicy&printer_friendly=1" title="View Privacy Policy (opens new window)" target="_blank" > </a>

</td>
</tr>

</table>
<br />
</td>

</tr>

<tr>
<td colspan="3" align="center">
<input type="submit" name="ACTION_SUBMIT_SURVEY_RESPONSE" id="ACTION_SUBMIT_SURVEY_RESPONSE" value="Submit" class="Button" />
</td>

</tr>
</table>
<input type="hidden" name="SURVEY_ID" id="SURVEY_ID" value="11460" />
<input type="hidden" name="USER_HAS_TAKEN" id="USER_HAS_TAKEN" value="null" />
<input type="hidden" name="SURVEY_IGNORE_ERRORS" id="SURVEY_IGNORE_ERRORS" value="TRUE" />
<input type="hidden" name="QUESTION_STAG_APP_ID" id="QUESTION_STAG_APP_ID" value="" />
<input type="hidden" name="QUESTION_STAG_APP_REF_ID" id="QUESTION_STAG_APP_REF_ID" value="" />
<input type="hidden" name="QUESTION_STAG_CTX_TYPE" id="QUESTION_STAG_CTX_TYPE" value="" />

<input type="hidden" name="ERRORURL" id="ERRORURL" value="http://www2.aspca.org/site/PageServer?pagename=test_testy_test" />

<span style="display:none">
<table border="0"><tr><td>
<label for="denySubmit">Spam Control Text:</label>&nbsp;
<input type="text" name="denySubmit" id="denySubmit" value=""
alt="This field is used to prevent form submission by scripts." />&nbsp;Please leave this field empty
</td></tr></table>
</span>
</form>

I'm new to Flash and am justing bumping my head into a wall looking at all the available online tutorials to even see if this is possible.

Any help would be appreciated.

gnomeontherun
07-23-2009, 10:33 AM
If you need the ID from the form tag itself, then no. However if you need the values of the hidden input fields, that is possible.

You will use the LoadVars.send method

http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001789.html

Quick example that you can build from



var my_lv:LoadVars = new LoadVars();
// Set variables for form
my_lv.SURVEY_ID = "11460";
my_lv.SURVEY_IGNORE_ERRORS = "true";
my_lv.QUESTION_STAG_APP_ID = "";
my_lv.QUESTION_STAG_APP_REF_ID = "";
my_lv.QUESTION_STAG_CTX_TYPE = "";
// Set variables from entry blanks
my_lv.SURVEY_IGNORE_ERRORS = emailAddress.text;
my_lv.send("setscore.cfm", "_blank", "POST");



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum