PDA

View Full Version : help with cyntex error



msn_jrd
06-22-2013, 02:28 AM
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

traq
06-22-2013, 02:39 AM
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 (http://css-tricks.com/reduced-test-cases/) using an online tool like jsfiddle (http://jsfiddle.net)

* not a picture of the code.
sharing the contents of the error message is always helpful also.

msn_jrd
06-22-2013, 03:00 AM
sorry about that my editor shows there to be a error at the end of the code line 34 });


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;

});
});

traq
06-22-2013, 03:42 AM
Try indenting your code uniformly - it helps with readability:
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:
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.