# MX button component \> 2004 button component

**URL:** <https://forum.kirupa.com/t/mx-button-component-2004-button-component/117067>\
**Category:** Uncategorized\
**Created:** [July 23, 2004, 9:32pm UTC](https://forum.kirupa.com/t/mx-button-component-2004-button-component/117067 "2004-07-23T21:32:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tranism](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/tranism/32/269_2.png) [@tranism](https://forum.kirupa.com/u/tranism)\
**Post date:** [July 23, 2004, 9:32pm UTC](https://forum.kirupa.com/t/mx-button-component-2004-button-component/117067/1 "2004-07-23T21:32:07Z")

</div>

**HELP!**

okay, I’m moving from MX to MX2004 and I’m having trouble with MX2004 button component. I’m used to the change click handler function and I know for MX2004, I need to use a listener but I can’t get my code to work. Whats wrong? :upset: :sigh: :crazy: :huh: ☹

[AS]  
onSubmitListener = new Object();  
onSubmitListener.click = function();  
{  
//Create a new LoadVars instance for the form data  
formData = new LoadVars();  
//Initialize formData variables  
formData.txtZip = “”;  
formData.cboDist = “”;  
formData.dealer = “stores”;  
//Gather the order information into a LoadVars Instance  
formData.txtZip = escape(txtZip.text);  
formData.cboDist = cboDist.getValue();  
formData.dealer = “stores”;

```
//Create another LoadVars instance to receive the server's reply
replyData = new LoadVars();
//Initialize reply variable
replyData.reply_txtZip = "";
replyData.reply_cboDist = "";
replyData.reply_dealer = "stores";
//Specify a function to call when this new instance receives the reply
replyData.onLoad = handleReply;
//Submit the data
formData.sendAndLoad("http://www.blahblah.com", replyData, "POST");
//Telling the user what is happening
scroller.text = "Please wait while your information is being processed. . .";

```

}  
onSubmit.addEventListener(“click”, onSubmitListener);  
}

function handleReply(success) {  
if (success) {  
trace(“done loading”);  
scroller.html = true;  
scroller.htmlText = replyData.textfield;  
} else {  
scroller.text = “There was a problem submitting your information. The server my be down or not responding.”;  
}  
}  
[/AS]
