Vars: flash ->javascript->predefined cgi-script?

  • greenberry
  • Born
  • Born
  • greenberry
  • Posts: 2

Post 3+ Months Ago

Hi,

I can't figure this out, hope someone can help me out.
I have a email-form in flash (mx 2004).
I have a website at xs4all, a basic account and this provider does not allow the use of php with this account.

But they do offer the use of a cgi-script (mail-a-form,they call it,you can't edit it)
This is all perfectly working if you use the HTML-code they provide, most important that you use FORM METHOD="post", I tried to send the needed variable(s) directly from within flash but I got an error back the it wasn't using the FORM METHOD="post". thingy

So i thought I just pass the email variable from flash <with getUrl> to a javascript function and from there place them in this form and submit it with the same function.....;

This is the code for the form in my index.html in the body:

Code: [ Select ]
<FORM METHOD="post" ACTION="/cgi-bin/mail-a-form" NAME="emailForm">
<INPUT TYPE="hidden" NAME="missing" VALUE="http://www.xs4all.nl/~accountname/">
<INPUT TYPE="hidden" NAME="from" value="">
<INPUT TYPE="hidden" NAME="subject" VALUE="email sent after website visit">
<INPUT TYPE="hidden" NAME="to" VALUE="myname@xs4all.nl">
<INPUT TYPE="hidden" NAME="required" VALUE="from">
</FORM>
  1. <FORM METHOD="post" ACTION="/cgi-bin/mail-a-form" NAME="emailForm">
  2. <INPUT TYPE="hidden" NAME="missing" VALUE="http://www.xs4all.nl/~accountname/">
  3. <INPUT TYPE="hidden" NAME="from" value="">
  4. <INPUT TYPE="hidden" NAME="subject" VALUE="email sent after website visit">
  5. <INPUT TYPE="hidden" NAME="to" VALUE="myname@xs4all.nl">
  6. <INPUT TYPE="hidden" NAME="required" VALUE="from">
  7. </FORM>


This is the javascript function to call from within flash:



Code: [ Select ]

<SCRIPT LANGUAGE="javascript">
function subMitEmail(email,emailName){

var email = email
var name = emailName
document.emailForm.from.value = name
document.emailForm.required.value = email
document.emailForm.submit();
};
</script>
  1. <SCRIPT LANGUAGE="javascript">
  2. function subMitEmail(email,emailName){
  3. var email = email
  4. var name = emailName
  5. document.emailForm.from.value = name
  6. document.emailForm.required.value = email
  7. document.emailForm.submit();
  8. };
  9. </script>


in actionscript i use:


Code: [ Select ]
 
getURL("javascript:subMitEmail(" + email + "," + emailName +")", "_SELF","POST");

  1.  
  2. getURL("javascript:subMitEmail(" + email + "," + emailName +")", "_SELF","POST");


In the javascript function I tried to use document.emailForm.from.write(email) but with no succes either.
I think i am getting closes to a solution but don't know what to do anymore, any suggestions???

Thanks in advance,

[blur]Berry.[/blur]
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • greenberry
  • Born
  • Born
  • greenberry
  • Posts: 2

Post 3+ Months Ago

Almost working now, it seems that my function in javascript wants it's arguments as a string ,so my in flash getURL should be:

Code: [ Select ]
getURL("javascript:subMitEmail(' "+email+" ')");


(single quotes used now around my variable)

and changed my function to (in put it in the head of the html):

Code: [ Select ]
<script type="text/javascript">

  function subMitEmail(emailAdress)

  {

    var email = emailAdress

    document.forms.emailForm.from.value = email

    document.forms.emailForm.submit();

    window.status="je emaildress(" + email + ") is verstuurd aan me@xs4all.nl"

  };
</script>
  1. <script type="text/javascript">
  2.   function subMitEmail(emailAdress)
  3.   {
  4.     var email = emailAdress
  5.     document.forms.emailForm.from.value = email
  6.     document.forms.emailForm.submit();
  7.     window.status="je emaildress(" + email + ") is verstuurd aan me@xs4all.nl"
  8.   };
  9. </script>


and changed the form;
Code: [ Select ]

<FORM METHOD="post" ACTION="/cgi-bin/mail-a-form" NAME="emailForm">
<INPUT TYPE="hidden" NAME="to" VALUE="Me@xs4all.nl">
<INPUT TYPE="text" NAME="from" value="">
<INPUT TYPE="hidden" NAME="subject" VALUE="Formulier verstuurd vanaf leodesign.nl">
<INPUT TYPE="hidden" NAME="missing" VALUE="http://www.xs4all.nl/~accountname/missing.html">

<INPUT TYPE="hidden" NAME="nextpage" VALUE="http://www.xs4all.nl/~accountname/nextpage.html">
</FORM>
  1. <FORM METHOD="post" ACTION="/cgi-bin/mail-a-form" NAME="emailForm">
  2. <INPUT TYPE="hidden" NAME="to" VALUE="Me@xs4all.nl">
  3. <INPUT TYPE="text" NAME="from" value="">
  4. <INPUT TYPE="hidden" NAME="subject" VALUE="Formulier verstuurd vanaf leodesign.nl">
  5. <INPUT TYPE="hidden" NAME="missing" VALUE="http://www.xs4all.nl/~accountname/missing.html">
  6. <INPUT TYPE="hidden" NAME="nextpage" VALUE="http://www.xs4all.nl/~accountname/nextpage.html">
  7. </FORM>


The only problem now is that i can't set the input field from to hidden cause my provider is given me then an error that the value of this field is incorrect.


Does anybody now how i can workaround that? (making it the background color would be my last option...)


thnx ,

Berry

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 14 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.