Error Messages Not posting on Form

I’m trying to modify a customized form (albeit deprecated) that posts to Constant Contact. However, I’m having a hard time getting the custom error messages to post if someone does not post input within specific fields. I only have three fields and the only error message that’s posting is ‘This field is required’ instead of using the customized error I’ve created.

Thank you in advance.

Here’s the code:

<div role="main" class="section section-style-<?php echo the_sub_field( 'section_id' ); ?>" style="color: <?php echo the_sub_field( 'section_text_color' ); ?>;  background-color: <?php echo the_sub_field( 'section_background_color' ); ?>; border-top: 2px solid <?php echo the_sub_field( 'top_border' ); ?>; border-bottom: 2px solid <?php echo the_sub_field( 'bottom_border' ); ?>; <?php if (get_sub_field( 'remove_top_margin' )) { ?> padding-top: 2px;<?php } ?>  <?php if (get_sub_field( 'remove_bottom_margin' )) { ?> padding-bottom: 2px;<?php } ?>">
	<div class="container">
    	<div class="row">				
    		<div class="row-height">
      				<div class="col-md-8 col-height sidebar-page-main">
						<?php echo the_sub_field( 'text' ); ?>
					</div>  <!-- /col-md-8 -->
      				<div class="col-md-4 col-height" style="padding-top: 30px; background-color: <?php echo the_sub_field( 'sidebar_background_color' ); ?>;">
<!--Begin CTCT Sign-Up Form-->
<!-- EFD 1.0.0 [Sat Jan 28 20:57:44 EST 2017] -->
<div class="ctct-embed-signup">
   <div class="contact-form-wrapper">
       <span id="success_message" style="display:none;">
           <div style="text-align:center;">Thanks for signing up!</div>
       </span>
       <form data-id="embedded_signup:form" class="ctct-custom-form Form" name="embedded_signup" method="POST" action="https://visitor2.constantcontact.com/api/signup" role="form" id="signup">
           <h3 style="text-align: center;">STAY CONNECTED!<br />Sign up for our monthly newsletter &amp; alerts</h3>
          
           <!-- The following code must be included to ensure your sign-up form works properly. -->
           <input data-id="ca:input" type="hidden" name="ca" value="be455d59-593e-4ea5-81b7-fff6d6b09a3d">
           <input data-id="list:input" type="hidden" name="list" value="1">
           <input data-id="source:input" type="hidden" name="source" value="EFD">
           <input data-id="required:input" type="hidden" name="required" value="list,email,first_name,last_name">
           <input data-id="url:input" type="hidden" name="url" value="">
           <p data-id="Email Address:p" ><label data-id="Email Address:label" data-name="email" class="ctct-form-required" for="email">Email Address</label> <input data-id="Email Address:input" type="text" name="email" value="" maxlength="80" id="email" tabindex="1"></p>
           <p data-id="First Name:p" ><label data-id="First Name:label" data-name="first_name" class="ctct-form-required" for="first name">First Name</label> <input data-id="First Name:input" type="text" name="first_name" value="" maxlength="50" id="first name" tabindex="2"></p>
           <p data-id="Last Name:p" ><label data-id="Last Name:label" data-name="last_name" class="ctct-form-required" for="last name">Last Name</label> <input data-id="Last Name:input" type="text" name="last_name" value="" maxlength="50" id="last name" tabindex="3"></p>
           <button type="submit" class="ctct-button Button--block Button-secondary blue-button" data-enabled="enabled" tabindex="4">Sign Up</button>
       	<div><p class="ctct-form-footer">By submitting this form, you are granting: The Bazelon Center for Mental Health Law, 1090 Vermont Avenue, NW Suite 220, Washington, DC, 20005, United States, http://www.bazelon.org permission to email you. You may unsubscribe via the link found at the bottom of every email.  (See our <a href="http://www.constantcontact.com/legal/privacy-statement" target="_blank">Email Privacy Policy</a> for details.) Emails are serviced by Constant Contact.</p></div>
       </form>
   </div>
</div>
<script type='text/javascript'>
   var localizedErrMap = {};
   localizedErrMap['required'] = 	'This field is required.';
   localizedErrMap['ca'] = 		    'An unexpected error occurred while attempting to send email.';
   localizedErrMap['email'] =   	'Please enter your email address in name@email.com format.';
   localizedErrMap['generic'] = 	'This field is invalid.';
   localizedErrMap['shared'] = 		'Sorry, we could not complete your sign-up. Please contact us to resolve this.';
   var postURL = 'https://visitor2.constantcontact.com/api/signup';
</script>
<!--<script type='text/javascript' src='https://static.ctctcdn.com/h/contacts-embedded-signup-assets/1.0.2/js/signup-form.js'></script>-->
<script type='text/javascript' src='http://www.bazelon.org/wp-content/themes/bazelon/js/signup-form.js'></script>
<!--End CTCT Sign-Up Form-->	
						<br />				
						<?php echo the_sub_field( 'text_2' ); ?>
					</div>  <!-- /col-md-4 -->
			</div> <!-- /row-height -->
    	</div>  <!-- /row -->
	</div>  <!-- /container -->
</div>  <!-- /section -->

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.