Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6879061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:48:01+00:00 2026-05-27T04:48:01+00:00

I’ve just been helped with some functions and callbacks to get this animation on

  • 0

I’ve just been helped with some functions and callbacks to get this animation on my form once submitted:

            $("#message").show().delay(5000).fadeOut('fast', function(){
            $("#slide_panel").slideToggle("slow");
});

Though, the problem I have now is, if someone had to submit the form without entering the correct details, the error message will also pop up (pops up in the same div “message” as the thank you message), delays for 5 seconds and then closes the form.

Of course, I don’t want it to close the form, instead show the error message for 5 seconds and then fadeout the error message.

Anything I need to add here:

function(data){
            document.getElementById('message').innerHTML = data;
            $('#message').slideDown('slow');
            $('#contactform img.loader').fadeOut('fast',function()
{$(this).remove()});
            $('#submit').removeAttr('disabled');
            if(data.match('success') != null);
            $('#name').val( "" );
            $('#email').val( "" );
            $('#phone').val( "" );
            $('#dayin').val( "" );
            $('#dayout').val( "" );
            $('#comments').val( "" );
            $('#verify').val( "" );
            $("#message").show().delay(5000).fadeOut('fast', 
function(){
            $("#slide_panel").slideToggle("slow");
});

        }
    );

    });

    return false;

});

});

I’m assuming I need to do something similar to this code:

if(data.match('success') != null);

In my contact.php form…. I have this:

if (isset($_POST['verify'])) :
    $posted_verify   = $_POST['verify'];
    $posted_verify   = md5($posted_verify);
else :
    $posted_verify = '';
endif;

// Important Variables
$session_verify = $_SESSION['verify'];

if (empty($session_verify)) $session_verify = $_COOKIE['verify'];

$error = '';

    if(trim($name) == '') {
        $error .= '<li>Your name is required.</li>';
    }

    if(trim($email) == '') {
        $error .= '<li>Your e-mail address is required.</li>';
    } elseif(!isEmail($email)) {
        $error .= '<li>You have entered an invalid e-mail address.</li>';
    }

    if(trim($phone) == '') {
        $error .= '<li>Your phone number is required.</li>';
    } elseif(!is_numeric($phone)) {
        $error .= '<li>Your phone number can only contain digits.</li>';
    }

    if(trim($comments) == '') {
        $error .= '<li>You must enter a message to send.</li>';
    }

    if($session_verify != $posted_verify) {
        $error .= '<li>The verification code you entered is incorrect. 
</li>';
    }

    if($error != '') {
        echo '<div class="error_message">Attention! Please correct the  
errors below and try again.';
        echo '<ul class="error_messages">' . $error . '</ul>';
        echo '</div>';

    } else {

    if(get_magic_quotes_gpc()) { $comments = stripslashes($comments); }

Anything I need to do here? Or do I only need to edit the javascript file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:48:01+00:00Added an answer on May 27, 2026 at 4:48 am

    if you use JSON to call a function somewhere in the code behind you will be able to return a status property.

    I used it aswell in my current project and here is an example of how I used it:

    var link = '/brainbattleJSON/MarkAssignmentAsInProgress';
                    $(this).hide();
                    $.getJSON(link, { questionId: qId }, function (json) {
                       if(json.status == "ok"){
                       //do this
                       }else{
                       //do this
                       }
    
                    });
    

    Code behind:

    // your function with validation
    // if the form is valid make status "ok" otherwise put anything else
    Return Json(New With {.status = "ok"});
    

    I hope this can help you a bit 🙂

    Edit:

    You will need to change the value of var link to the path of your function where you check the form.
    Then where you now say if your error!=” you will send back the json.
    in this you will say:

    return json(new with{.status = 'error', .errors = 'yourErrors'})
    

    So for errors it might be useful to send an array just in case if you get more than 1 error on the form.
    All the messages will no longer be shown in php with echo but you will have to put the errors there with javascript.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.