A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 24

Thread: [RESOLVED] How to make a contactform in KM, all fields requird?

  1. #1
    Junior Member
    Join Date
    Jan 2009
    Location
    Amsterdam
    Posts
    20

    resolved [RESOLVED] How to make a contactform in KM, all fields requird?

    Hey people,
    i want to make something like this :


    And every field must be required to fill . And when you click on Send, send it to my mail.



    Thanks!
    Peace from the Netherlands!

  2. #2
    Junior Member
    Join Date
    Jan 2009
    Location
    Amsterdam
    Posts
    20

    Thumbs up

    Ok for now i will use another.
    I found on koolexchange a mailform.
    Filename: mailform

    I imported the .fun into my file.
    My file has 7 frames. I opened it on frame 2 and it goes on till frame 7..
    (Or is it cause it says it isn't connected to the server)
    I want this cause my file is 7 frames long, but if i go to frame 3,4,5,6,7 i see the Mailform.

    Can i do something like: Open in frame 2 and stop.
    Or must i increase my frames?

    Excuse me, if my english isn't correct. I hope u understand what i mean.


    Thanks
    Last edited by trendsetterz; 06-11-2009 at 07:03 PM.

  3. #3
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    what version of KM?

  4. #4
    Junior Member
    Join Date
    Jan 2009
    Location
    Amsterdam
    Posts
    20
    Hi i have version 7.0.

    Thanks

  5. #5
    Junior Member
    Join Date
    Jan 2009
    Location
    Amsterdam
    Posts
    20
    Don't worry. Thanks.
    I increased already the frames.
    It worked. One thing, when an error ocurs (when u don't fill the form) than u can press the button Back, than he starts again at frame 1 and not 3.
    But thanks anyway!

  6. #6
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Probably need to just change the action for the back button to go to the correct frame.

  7. #7
    Junior Member
    Join Date
    Jan 2009
    Location
    Amsterdam
    Posts
    20
    Workin indeed. Thanks!

  8. #8
    Junior Member
    Join Date
    Jan 2009
    Location
    Amsterdam
    Posts
    20
    In a new file it is workin.

    But in the .fun i'm workin, its gives a error:

    PHP Code:
    The following AS1 code was removed from the movie because it will definitely not compile as AS3.
    It is possible there is other code which will need to be converted to AS3.

    Object btn1:
    on (release) {
    problem="";

    lf="\n";

    if (
    n.text.length<3){

       
    problem+="Name to Short"+lf;
    }
    if (
    e.text.indexOf(",")>0){
        
    problem+="one Email address only please "+lf
        
    }
    if (
    m.text==""){
     
    problem+="Please enter a message"+lf;
    }

    if (
    e.text.length<7){
     
    problem +="email too short "+lf;
    }

    if  (
    e.text.indexOf("@")==-1){
     
    problem+="Email missing @"+lf;
    }

    if (
    e.text.indexOf(".")==-1){
     
    problem+="Email Missing dot"+lf;
    }

    if (
    e.text.indexOf("@")>e.text.indexOf(".")){
     
    problem+="Mal formed email"+lf;
    }

    if (
    e.text.lastIndexOf(".")>e.text.length-3){
     
    problem+="invalid Domain"+lf;
    }

    if (
    n.text==""){
    problem+="You must enter a name"+lf;
    }

    if (
    problem.length<1){
        
    emailvar.name=n.text
        emailvar
    .email=e.text
        emailvar
    .message=m.text
        emailvar
    .sendAndLoad("jjhsuhs.php",result,"POST");
        
    nextFrame();
    }

    if (
    problem.length>1){
        
    p.text="problem"
        
    gotoAndPlay("form_error");
    }

    }

    ---------------------------------------------
    Object mc2:
    on(release){
        
    m.text=e.text=n.text="";
        } 

    Is this because i didn't fill the mail yet.
    And when i press ok: i got this error:

    There are some instance name conflicts. The following changes have been made in exporting the swf.
    Action script code which references these instance names has not been changed.

    S56 -> S56_52
    btn1 -> btn1_71
    btn3 -> btn3_78

  9. #9
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    This is because the form is AS1 from KM6. I'm working on a new one for AS3 as we speak. Be patient I will get it done soon.

    [note] I moved this to the proper thread
    Last edited by blanius; 06-12-2009 at 09:30 AM.

  10. #10
    Junior Member
    Join Date
    Jan 2009
    Location
    Amsterdam
    Posts
    20
    Ok thanks man,
    appriciate.

    Goodluck!
    Peace

  11. #11
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Almost there.

    Just need to finish up and test the server side PHP

    Try the form, Extra feature try to add email headers to the text like bcc: or to: etc... This is what spammers do...
    Last edited by blanius; 06-19-2009 at 11:22 PM.

  12. #12
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    Also have one coming that utilizes an RTE to create formatted html mails. Yes, it has injection control

    Running here:

    http://www.km-codex.com/?page_id=421

    KM7/AS3/PHP

  13. #13
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    as usual one step ahead of me Chris lol

  14. #14

  15. #15
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    I'm pretty much done here as well just not getting my response back from server correctly, Server is sending it my AS3 is just bad....

    PHP Code:
    //code snippet of sending data
    status_txt.text="Sending...";
            
    submit_btn.enabled=false;
            
    //first we create a URL formated variables
            
    email_data="name="+name_txt.text
                        
    +"&email="+email_txt.text
                        
    +"&subject="+subject_txt.text
                        
    +"&message="+message_txt.text;
                        
    txt1.text=email_data;
            
    //then we create a URLVariables object and load our text
            
    URL_vars=new URLVariables(email_data);
            
    //Set it to use Text
            
    URL_vars.dataFormat=URLLoaderDataFormat.TEXT;
            
    //set the URLRequest data to our variables
            
    vRequest.data=URL_vars;
            
    //Actuall send it to the server
            
    vload.load(vRequest);
            
    //wait for it to be done sending 
            
    vload.addEventListener(Event.COMPLETE,done); 
    this is working but Event.Complete is not

    PHP Code:
    function done(e:Event){
        var 
    loader=new URLLoader(e.target);
        
    email_status=new URLVariables(loader.data).success;
        
    txt1.text=email.status;
        
    status_txt.text=email_status;
        if (
    email_status=="ok"){
            
    status_txt.text="Email recieved";
            }else{
            
    status_txt.text="There was an error. not sent"+email_status;
            }    


  16. #16

  17. #17
    Junior Member
    Join Date
    Jan 2009
    Location
    Amsterdam
    Posts
    20
    Uhhhhhhhhhhhhhhh it's now going a little to fast for me :P
    Or is the solution not find yet??

    Blanius the code you pasted is that of the mailform.fun file?

    &
    Chris Seahorn, i downloaded KM Codexcontactform and when i'm opened it and want to play it, it says:
    Can't find package etc.

    Greets!

  18. #18
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Chris's example uses the tweenmax or tweenlite classes. You need those to compile his version or remove the references to it.

    What I pasted is from mine, it's just quite working yet... I've having a problem with it still. AS3 is still new for me and I am away from it for long periods so I forget half of what I learn. I dealt with this same issue before but forget how I fixed it.

  19. #19
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    Since the source needs to be edited to insert your subject lines, I had hoped the commented section here:

    //Tweenmax classes need to be present!
    import gs.*;
    import gs.easing.*;
    import gs.events.*;
    import gs.utils.tween.*;
    import gs.plugins.*;


    would do the trick

  20. #20
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    I've upload mine now to the KoolExchange (look in the input forms section) for you to download as well. You would do well to look at both and see what you can learn from both, I know I'm studing Chris's example, he always does great work and usually has added features like using tweenmax which is pretty cool. Mine is a little simpler.

    Good luck Trend

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center