Hello all,
          I have been unable to figure out why something simple is not
happening in a form of mine.  I have a form that does successfully
take the user input and email it to us.  However, for some reason, the
Alert button that should give the user feedback is not working.  It
just hangs there when the user clicks on the submit button.

       I will need to share the code to get help with this.  It is
very basic and it does send the email message.  I'll trim off
extraneous appearance code that is not related to the actual logic of
the form.
So, we have the main application that has a Panel that calls the
ContactFormComp (for ContactFormComponent)(leaving off the Application
tag, of course:

<mx:Panel title="Contact Future Wave Designs">
        <forms:ContactFormComp id="MyContactForm"/>
</mx:Panel>

So, now we have the form component - this will be a bit longer, though
still rather simple, but I don't know why it doesn't call the Alert
function:

<?xml version="1.0" encoding="utf-8"?>
<mx:Form xmlns:mx="http://www.adobe.com/2006/mxml";>
        
    <mx:Script>
    <![CDATA[
        import mx.controls.Alert;
        import mx.rpc.events.FaultEvent;
        import mx.rpc.events.ResultEvent;
        
        private function sendMyData():void
        {
        var obj:Object = new Object();
        obj.Name = Name.text;
        obj.email = email.text;
        obj.phone = phone.text;
        obj.message = message.text;
        myContactService.send(obj);
        myContactService.resultFormat = "text";
        myContactService.addEventListener(ResultEvent.RESULT, resultHandler);
        myContactService.addEventListener(FaultEvent.FAULT, fault_handler);
        }
                
        private function resetForm(event:MouseEvent):void
        {
                Name.text = "";
                email.text = "";
                phone.text = "";
                message.text = "";
        }
                
        private function resultHandler(event:ResultEvent):void
        {
           Alert.show("Thank you!  Your message has been emailed", "Thank 
you!");
                        
        }
                
        private function fault_handler():void
        {
         Alert.show("There was a problem.", "Problem Encountered");
        }
        ]]>
        </mx:Script>
        
        
        <mx:HTTPService id="myContactService"
                 url="mail_sender.php"
                 method="POST"
                 result="resultHandler(event)"
                 resultFormat="text"/>
                 
        <mx:Label text="Your Contact Information"/>
        <mx:FormItem label="Name:">
                <mx:TextInput id="Name" width="200" />
        </mx:FormItem>
        <mx:FormItem label="Email:">
                <mx:TextInput id="email" width="200"/>
        </mx:FormItem>
        <mx:FormItem label="Phone Number:">
                <mx:TextInput id="phone" width="200"/>
        </mx:FormItem>
        <mx:FormItem label="Message:">
                <mx:TextArea id="message" width="200"/>
        </mx:FormItem>
        
        
        <mx:FormItem>
           <mx:Button label="Submit" fontSize="16" click="sendMyData()"/>
        </mx:FormItem>
        <mx:FormItem>
            <mx:Button label="Reset Form" fontSize="16"
click="resetForm(event)"/>
        </mx:FormItem>
</mx:Form>

I don't know if there is a problem with my php code but it does email
the form.  In order to share that, I have the php code in a text file
here:  http://futurewavedesigns.com/ContactUs/mail_sender.php.txt
You'll see it is basic.  Please let me know if you see any error
explaining why it doesn't get to the Alert message.
thanks, and
Here's an additional issue...
If anyone knows php how would I send a message from the php form
saying "Ok" or "Fault."  That is in the code but I am not sure how to
send it back to Flex.
Thanks
Bruce

Reply via email to