# Converting HTML Forms to Actionscript

**URL:** https://forum.kirupa.com/t/converting-html-forms-to-actionscript/56705
**Category:** Uncategorized
**Created:** [July 6, 2004, 11:54pm UTC](https://forum.kirupa.com/t/converting-html-forms-to-actionscript/56705 "2004-07-06T23:54:12Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![nlaffan](https://avatars.discourse-cdn.com/v4/letter/n/8491ac/32.png) [@nlaffan](https://forum.kirupa.com/u/nlaffan)
#### Post date: [July 6, 2004, 11:54pm UTC](https://forum.kirupa.com/t/converting-html-forms-to-actionscript/56705/1 "2004-07-06T23:54:12Z")

</div>

Hello,

I need to convert the below form - which is in HTML - to do the same thing in actionscript w/MX 2004. It is logging on to a firstclass server, so if you even have an example file of how this could work - that would be great.

Thanks

* * *

\<FORM name=“LOGINFORM” action=“[http://mail.myserver.com/Login](http://mail.myserver.com/Login)” target=“blank” method=“post” enctype=“application/x-www-form-urlencoded” onsubmit=“return CMD5(this);”\>  
\<TABLE align=“center” cellpadding=“0” cellspacing=“0” border=“0”\>

```
    &lt;TD&gt;&nbsp;&lt;/TD&gt;
    &lt;TD&gt;&lt;TABLE cellpadding="2" cellspacing="0" border="0"&gt;
        &lt;TR&gt; 
          &lt;TD&gt;&lt;INPUT name="userid" type="text" tabIndex="1" size="10" maxlength="15"&gt;&lt;/TD&gt;
		  &lt;TD&gt;&lt;INPUT type="password" name="password" size="10" maxlength="12" value="" tabIndex="2" onFocus="this.select();" onChange="sp=null;"&gt;&lt;/TD&gt;

       &lt;/TR&gt;

```

* * *

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 7, 2004, 6:58pm UTC](https://forum.kirupa.com/t/converting-html-forms-to-actionscript/56705/2 "2004-07-07T18:58:26Z")

</div>

You are goona have to make it do this yourself (we dont do work for you) using the components provided in flash and a little bit of actionscript. So make your form and give each component a unique instance name. Once you have that done make yourself a button. The actions for the button:

```auto

on(release) {
    loader = new LoadVars(); //create new loadVars object
    loader.variable = input_box.text; //set loadvars variable for sending VIA post method
    //do the above line for every object in your form replacing variable with the name of the object in the HTML form, and replacing input_box with the instance name of the object
    loader.send("page_that_form_was_going_to_be_submitted_to.ext", "POST");
}

```

That will do the same thing as the HTML form, however it will not display the page the info was sent to. If you would like to display a confirmation, or something like that, design the send to page so it returns a variable confirming the data, and use sendAndLoad instead of send. and add this underneath:

```auto

loader.onLoad = function(success) {
    if(success) {
        //confirmation actions
    } else {
        //error actions
    }
}

```

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 9, 2004, 12:39am UTC](https://forum.kirupa.com/t/converting-html-forms-to-actionscript/56705/3 "2004-07-09T00:39:00Z")

</div>

Thank you very much, that worked great. The only problem though is this portion of the form:

target=“blank” method=“post” enctype=“application/x-www-form-urlencoded”

Though the login now sends its variables, because it is trying to login to a firstclass server…it’s having trouble. I’m not familiar enough with HTML or Actionscript to send the encode type variable…

thanks.
