Email form not submitting

Hi
I tried this with the Mailchimp code then changed it to the Email Forms that comes with X.
It is on the content dock which appears half way down the scroll bottom left.

I can’t get the submit to do anything. Any ideas appreciated.

updated - the form actually does submit but there is no confirmation through Email Forms or Content Dock.

Hi There,

I got this error message when submited the email form:

Please follow up the steps below:

  1. Ensure everything is up to date according to our version compatibility list here. Please follow the best practices when updating your theme and plugins. Click here for more information.
  2. Go to X > Settings and click on the Clear Style Cache button.
  3. If you’re using a CDN(ex: CloudFlare), please clear the CDN’s cache and disable optimization services. For the CloudFlare you also need to follow the steps below besides the developer mode: https://xthemetips.com/using-cloudflare-rocket-loader-with-x-pro-and-x5/928/1
  4. Test for a plugin conflict. You can do this by deactivating all third-party plugins, and see if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.
  5. Remove custom CSS and Javascript from the options or Child Theme and test the case.
  6. Switch to the parent theme to check if the issue persists.
  7. Reset your htaccess file by renaming it to .htaccess-bak. Then in WP Admin Menu, go to Settings > Permalinks and just click the Save Changes button.
  8. Make sure that you’re running at least PHP v5.6.x or later to avoid any WordPress related incompatibility issues. If you’re not sure what your server configurations and settings are, install a plugin like WP-Serverinfo (https://wordpress.org/plugins/wp-serverinfo/) and check your server info by head over to Dashboard -> WP Serverinfo area.
  9. Check your PHP Max Execution Time and set it for 120 for optimal usage (https://thimpress.com/knowledge-base/how-to-increase-maximum-execution-time-for-wordpress-site/).
  10. Increase the PHP Memory Limit of your server. Click here for more detailed information and how to increase the PHP memory limit.

Let us know how it goes!

thank you
I have tried most of those but options won’t load so I wonder if it is a memory issue

Hi @lisacole1,

I checked and it’s known issue or bug, it’s a conflict between the Email Forms plugin and the latest version of the theme.

For now, could try ConvertPlus plugin for now and connect it to your MailChimp. Then use its shortcode to embed and replace the current Email Forms.

Please check this https://theme.co/apex/forum/t/extension-convertplus/664 for further information about the ConvertPlus.

Thanks!

1 Like

ah great, that saves me some time messing around with the site, thank you!

You’re welcome.

Just in case users need a band-aid fix until this is sorted by the Theme.co team.

Changing the main.js in the plugin folder /wp-content/plugins/tco-email-forms/email-integration/js/site/main.js to the following code will use the native browser alert instead of the broken alert function.

// =============================================================================
// EMAIL-INTEGRATION/JS/SITE/MAIN.JS
// -----------------------------------------------------------------------------
// Plugin site scripts.
// =============================================================================

// =============================================================================
// TABLE OF CONTENTS
// -----------------------------------------------------------------------------
//   01. Handle Form Submissions
// =============================================================================

// Handle Form Submissions
// =============================================================================

jQuery(document).ready(function($) {

  function confirm_subscription( form ) {

    var confirm_type = form.data('tco-email-confirm');

    if ( confirm_type === 'Message' ) {
     alert(form.data('tco-email-message'));
    }

    if ( confirm_type === 'Redirect' ) {
      window.location.href = form.data('tco-email-redirect');
    }

  }

function make_alert( content, class_name ) {
    alert(content);
}

  function nameIntoArray( name, value ) {
    if ( typeof name === 'object' ) {
      return  nameIntoArray( name, value );
    }
    return value;
  }


  $('.tco-subscribe-form').submit(function(e) {

    //
    // Prevent default behavior.
    //

    e.preventDefault();

    //
    // Remove old alerts
    //

    $('.tco-subscribe-form-alert-wrap').remove();

    //
    // Make note of our form.
    //

    $form = $(this);


    //
    // Prevent extra submissions.
    //

    $form.find('input[type="submit"]').prop('disabled', true).addClass('btn-muted');


    //
    // Craft data for AJAX request.
    //

    var data = $form.serializeArray().reduce(function(obj, item) {

      var iname = item.name.match(/\[(.*?)\]/g);
      $.each(iname,  function ( index, value ) {
        iname[ index ] = value.replace('[', '').replace(']', '').replace('-', '_');
      });

      switch ( iname.length ) {

        case 4:
          if ( typeof obj[ iname[0] ] === 'undefined' ) {
            obj[ iname[0] ] = {};
          }
          if ( typeof obj[ iname[0] ][ iname[1] ] === 'undefined' ) {
            obj[ iname[0] ][ iname[1] ] = {};
          }
          if ( typeof obj[ iname[0] ][ iname[1] ] === 'undefined' ) {
            obj[ iname[0][ iname[1] ][ iname[2] ] ] = iname[3] === '' ? [] : {};
          }
          if ( iname[3] === '' ) {
            obj[ iname[0] ][ iname[1] ][ iname[2] ].push( item.value || '' );
          } else {
            obj[ iname[0] ][ iname[1] ][ iname[2] ][ iname[3] ]= item.value || '';
          }
          break;

        case 3:
          if ( typeof obj[ iname[0] ] === 'undefined' ) {
            obj[ iname[0] ] = {};
          }
          if ( typeof obj[ iname[0] ][ iname[1] ] === 'undefined' ) {
            obj[ iname[0] ][ iname[1] ] = iname[2] === '' ? [] : {};
          }
          if ( iname[2] === '' ) {
            obj[ iname[0] ][ iname[1] ].push( item.value || '' );
          } else {
            obj[ iname[0] ][ iname[1] ][ iname[2] ]= item.value || '';
          }
          break;

        case 2:
          if ( typeof obj[ iname[0] ] === 'undefined' ) {
            obj[ iname[0] ] = iname[1] === '' ? [] : {};
          }
          if ( iname[1] === '' ) {
            obj[ iname[0] ].push( item.value || '' );
          } else {
            obj[ iname[0] ][ iname[1] ]= item.value || '';
          }
          break;

        case 1:
          if (iname[0] === 'id') {
            iname[0] = 'form_id';
          }
          if (iname[0] === 'email') {
            iname[0] = 'email_address';
          }
          obj[ iname[0] ] = item.value || '';
          break;
      }

      return obj;
    }, {});

    postdata = {
      action : 'tco_subscribe',
      data   : data
    };

    //
    // Submit form.
    //

    $.post(email_forms.ajax_url, postdata, function(response) {
      data = $.parseJSON(response);
      if ( data.error ) {
        alert(data.message);
        $form.find('input[type="submit"]').prop('disabled', false).removeClass('btn-muted');
      } else {
        confirm_subscription($form);
    $form[0].reset();
    $form.find('input[type="submit"]').prop('disabled', false).removeClass('btn-muted');
      }
    });

  });

});

All the best,
Chris.

Thanks for sharing Chris :slight_smile:

1 Like

Since this is a known bug, will it be addressed in the next X update?

Hello @armintz,

It’s difficult for us to provide ETA whether or not specific bug will get addressed in next release. However, our developers are at work. You can keep an eye on changelog page for new product announcements.

https://theme.co/changelog/

Thanks.

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