Forms Not Showing Up

Since I updated to the latest theme, my forms don’t show correctly unless I’m signed into WordPress. This didn’t use to happen with the classic sections/elements. It only happens with the new ones.

Can you tell me how to solve this?

I use forms directly from Active Campaign. I’ve already notified them and they’ve responded it’s an issue with the theme. It’s not on their end.

In adding, I tested the forms in another site, using a different theme, and they show up just fine using the same code, without me having to be logged into WordPress.

Thanks.

Hey,

Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

– Link to your site
– WordPress Admin username / password

Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

Hello There,

Thanks for providing the information. I have logged in and investigated the issue. I found out that you have inserted an incomplete JS code:

window._show_thank_you = function(id, message, trackcmp_url) {
  var form = document.getElementById('_form_' + id + '_'), thank_you = form.querySelector('._form-thank-you');
  form.querySelector('._form-content').style.display = 'none';
  thank_you.innerHTML = message;
  thank_you.style.display = 'block';
  if (typeof(trackcmp_url) != 'undefined' && trackcmp_url) {
    // Site tracking URL to use after inline form submission.
    _load_script(trackcmp_url);
  }
  if (typeof window._form_callback !== 'undefined') window._form_callback(id);
};
window._show_error = function(id, message, html) {
  var form = document.getElementById('_form_' + id + '_'), err = document.createElement('div'), button = form.querySelector('button'), old_error = form.querySelector('._form_error');
  if (old_error) old_error.parentNode.removeChild(old_error);
  err.innerHTML = message;
  err.className = '_error-inner _form_error _no_arrow';
  var wrapper = document.createElement('div');
  wrapper.className = '_form-inner';
  wrapper.appendChild(err);
  button.parentNode.insertBefore(wrapper, button);
  if (html) {
    var div = document.createElement('div');
    div.className = '_error-html';
    div.innerHTML = html;
    err.appendChild(div);
  }
};
window._load_script = function(url, callback) {
    var head = document.querySelector('head'), script = document.createElement('script'), r = false;
    script.type = 'text/javascript';
    script.charset = 'utf-8';
    script.src = url;
    if (callback) {
      script.onload = script.onreadystatechange = function() {
      if (!r && (!this.readyState || this.readyState == 'complete')) {
        r = true;
        callback();
        }
      };
    }
    head.appendChild(script);
};
(function() {
  if (window.location.search.search("excludeform") !== -1) return false;
  var getCookie = function(name) {
    var match = document.cookie.match(new RegExp('(^|; )' + name + '=([^;]+)'));
    return match ? match[2] : null;
  }
  var setCookie = function(name, value) {
    var now = new Date();
    var time = now.getTime();
    var expireTime = time + 1000 * 60 * 60 * 24 * 365;
    now.setTime(expireTime);
    document.cookie = name + '=' + value + '; expires=' + now + ';path=/';
  }
      var addEvent = function(element, event, func) {
    if (element.addEventListener) {
      element.addEventListener(event, func);
    } else {
      var

The code is unfinished. Could you please provide the complete code? And by the way, please keep in mind that the custom js section when outputted in the front end, it will be wrap with <script>. Inserting a code with a <script> will create issue as well. To resolve this, you must close the tag first. For example, instead of inserting this:

<script src="https://juliathie.activehosted.com/f/embed.php?id=3" target="_blank" type="text/javascript" charset="utf-8"></script>

You will have to insert it this way:

</script>
<script src="https://juliathie.activehosted.com/f/embed.php?id=3" target="_blank" type="text/javascript" charset="utf-8">

Hope this make sense.

That code was probably lost in the update and all the other craziness because it was put up entirely before.

On another note, I tried what you told me and it still didn’t solve the issue. I tried it with the . I tried it without it and making sure all the code was in there.

So any other solution?

Is there a better way to add an Active Campaign form than separating all these codes everywhere?

Because I even tried the content element and entered everything there and I still had the same issue when that shouldn’t have happened since nothing was missing.

Like I said, this didn’t happen with the old sections and elements.

Hi there,

I checked the services page and the problem seems to be initiated from the Content Area element. That is not a good choice to add forms. I changed that and added the code to the Raw Content Area element and now the form is showing.

To add a link to a script from another domain you should not add it in the X > Launch > Options > JS. You need to add it to your Child Theme. I deleted the Js script call from there.

Now you need to do as follows:

  • Install the Child Theme.
  • Enable it as your main theme of the website
  • Go to Appearance > Editor and click on the functions.php at the right section of the screen:
  • Add the code below to the end of the current code:
function third_party_tracking_code() { ?>

<script src="https://juliathie.activehosted.com/f/embed.php?id=3" target="_blank" type="text/javascript" charset="utf-8"></script>	

<?php }
add_action( 'wp_head', 'third_party_tracking_code' );

For the detailed description of why you should use the code above to add the script kindly read the article below:

https://theme.co/apex/forum/t/customizations-actions-and-filters-in-x/208

Thank you.

Thank you. I’ll make that adjustment in the home page too and add the JS on there. That works.

Cool, glad we could help,

Cheers :slight_smile:

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