Question

We all know that when a contact form successfully sent the information that is inputted to them they will display a message of "Your Message has been sent". But I want to change it to "Thank you for your message" what should I do? Thanks in advance

<!-- Validation --> 
<div style='text-align: center; max-width: 222px; width: 100%'> 
<p class='contact-form-error-message' id='ContactForm1_contact-form-error-message'/> 
<p class='contact-form-success-message' id='ContactForm1_contact-form-success-message'/> 
</div> 
        <div style='text-align: center; max-width: 222px; width: 100%'>
          <p class='contact-form-error-message' expr:id='data:widget.instanceId + &quot;_contact-form-error-message&quot;'/>
          <p class='contact-form-success-message' expr:id='data:widget.instanceId + &quot;_contact-form-success-message&quot;'/>
        </div>
Was it helpful?

Solution

Include the following code snippet within <head></head>:

<script src='//code.jquery.com/jquery-latest.js'></script>
<script type='text/javascript'>//<![CDATA[
$(function(){
  $('.contact-form-button-submit').click(function(){
    $('.contact-error,.contact-success').hide();
    var email = "Cowboy! Provide the correct E-mail.";
    var description = "Whats your problem Sir write in description box.";
    var success_msg = "Success";
    if($('.contact-form-error-message-with-border').text()=="A valid email address is required."){
      $('.contact-form-error-message-with-border').replaceWith("<div class='contact-error'>"+email+"</div>");
      $('.contact-form-error-message-with-border').hide();
    } else if($('.contact-form-error-message-with-border').text()=="Message field cannot be empty."){
      $('.contact-form-error-message-with-border').replaceWith("<div class='contact-error'>"+description+"</div>");
      $('.contact-form-error-message-with-border').hide();
    } else {
      // success case
      $('.contact-error,.contact-success').html(success);
    }
  });
});
//]]></script>

email is the error message for email, while description is the error message for message.

Note: this original snippet is from here (Author: Mohammad Hamza Dhamiya), success message modification added.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top