Advanced Search

Results 1 to 4 of 4

Thread: help with cyntex error

  1. #1
    Join Date
    Dec 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default help with cyntex error

    i know very little code and and trying to get a contact form working but this file has a error the editor shows it to be after: return false; at the botttom hopefully it will be ovious to someone that knows was there looking at http://i.imgur.com/1FsFsiN.jpg

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,624
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Your question is unclear.
    Please provide more information, and be as specific as possible.
    • What do you want to accomplish?
    • What have you already tried?
    • What problems did you encounter?

    Please be sure to include all relevant code* and/or a link to the page in question.
    You might also consider making a reduced test case using an online tool like jsfiddle


    * not a picture of the code.
    sharing the contents of the error message is always helpful also.
    We Only Torture the Folks We Don't Like (You're Probably Gonna Be Okay)
    It's a Party in the CIA

  3. #3
    Join Date
    Dec 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    sorry about that my editor shows there to be a error at the end of the code line 34 });

    Code:
    var messageDelay = 2000;
    $(function(){
     $("#inquiry_form").submit(function(){
     $("#btn_submit").value='Please wait...';
     
     $.post("contactform.php?send=comments", $("#inquiry_form").serialize(),
     function(data){
     if(data.frm_check == 'error'){
     
     $("#message_post").html("<div class='errorMessage'>ERROR: " + data.msg + "!</div>");
     document.ContactForm.submitf.value='Resend >>';
     document.ContactForm.submitf.disabled=false;
     } else {
     $("#message_post").html("<div class='successMessage'>Your message has been sent successfully!</div>");
     $("#name").val("");
     $("#email").val("");
     $("#message").val("");
     $("#subject").val("");
     $('#message_post').delay(messageDelay+500).fadeTo( 'slow', 1 );
     $('#message_post').val("").fadeTo( 'slow', 1 );
     
     $("#btn_submit").value='Send >>';
     }
     
     }, "json");
     function disablePopupContact(){
    				if(popupContactStatus==1){
    					$("#popupContact").fadeOut("slow");
    					popupContactStatus = 0;
    				}
     
     return false;
     
     });
    });
    Last edited by msn_jrd; 06-22-2013 at 03:07 AM.

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,624
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Try indenting your code uniformly - it helps with readability:
    Code:
    var messageDelay = 2000;
    $(function(){
        $("#inquiry_form").submit(function(){
            $("#btn_submit").value='Please wait...';
            
            $.post(
                "contactform.php?send=comments", $("#inquiry_form").serialize()
                , function(data){
                    if(data.frm_check == 'error'){ 
                        $("#message_post").html("<div class='errorMessage'>ERROR: " + data.msg + "!</div>");
                        document.ContactForm.submitf.value='Resend >>';
                        document.ContactForm.submitf.disabled=false;
                    } else {
                        $("#message_post").html("<div class='successMessage'>Your message has been sent successfully!</div>");
                        $("#name").val("");
                        $("#email").val("");
                        $("#message").val("");
                        $("#subject").val("");
                        $('#message_post').delay(messageDelay+500).fadeTo( 'slow', 1 );
                        $('#message_post').val("").fadeTo( 'slow', 1 );
                        $("#btn_submit").value='Send >>';
                    }
                }
                , "json"
            );
            
            function disablePopupContact(){
                if(popupContactStatus==1){
                    $("#popupContact").fadeOut("slow");
                    popupContactStatus = 0;
                } 
                return false;
    
        });
    });
    Now, it's much easier to see that there's a missing curly brace (it belongs to your disablePopupContact function), because you can notice that the opening and closing braces don't line up properly:
    Code:
    var messageDelay = 2000;
    $(function(){
    .   $("#inquiry_form").submit(function(){
    .   .
    .   .     /* snip */
    .   .
    .   .   function disablePopupContact(){
    .   .   .   if(popupContactStatus==1){
    .   .   .       $("#popupContact").fadeOut("slow");
    .   .   .       popupContactStatus = 0;
    .   .   .   } 
    .   .   .   return false;
    .   .   }  /* <-- this one was missing */
    .   }); /* <-- matches $('inquiry_form').submit */
    }) /* <-- matches anon function */
    See how that closing brace is now at the same column position (8) that the word "function" starts on?

    Also, most code editors have the ability to highlight opening/closing brace pairs, and warn you when one is missing.
    Last edited by traq; 06-22-2013 at 03:53 AM.
    We Only Torture the Folks We Don't Like (You're Probably Gonna Be Okay)
    It's a Party in the CIA

Similar Threads

  1. Replies: 2
    Last Post: 05-06-2011, 08:24 AM
  2. Replies: 1
    Last Post: 01-28-2011, 02:39 AM
  3. Replies: 2
    Last Post: 02-12-2010, 08:53 AM
  4. Replies: 1
    Last Post: 04-26-2008, 11:22 AM
  5. Customize the Error Object in JavaScript (Error Handler Script)
    By hari.gomatum in forum Submit a DHTML or CSS code
    Replies: 1
    Last Post: 12-13-2007, 05:56 AM

Bookmarks

Posting Permissions

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