EvanHerman / yikes-inc-easy-mailchimp-extender

Easy Forms for MailChimp WordPress Plugin
http://yikesplugins.com
GNU General Public License v2.0
25 stars 28 forks source link

Nothing Happens #78

Closed MichaelAllanson62 closed 10 years ago

MichaelAllanson62 commented 10 years ago

I've used the plug-in for a while, updated yesterday, now nothing happens when I click the submit button on the form. It has worked fine up until now. The form is at http://www.lifesentencepublishing.com/bloggers/

EvanHerman commented 10 years ago

Hi Michael,

The only thing we updated yesterday was a conditional check to see if your server is running with an open base directory set. If it isn't your site should have remain unaffected. Also, this change should have no affect on the front end of the site, but instead the way your blog communicates with MailChimp.

When you submit the form, your site is throwing a javascript error: Uncaught Error: Syntax error, unrecognized expression: .{f41d53ae42FORMAT}:checked which is being thrown by jQuery itself and not our plugin. Have you installed any other plugins recently that could be interfering?

MichaelAllanson62 commented 10 years ago

Thank you for your reply. I didn't install any new plug-ins but I did update some.

EvanHerman commented 10 years ago

Can you try and replace a line of code for me? This may be the issue here:

Inside of class.yksemeBase.php, like 1783 we have a conditional check for radio buttons:

case 'radio':
    $js .=  "if($".$prefix."('.{".$field['name']."}:checked').length <= 0)
        {
        msg += '* {".$field['label']."}'+'\\n';
        err++;
        }";
    break;

changed to -

case 'radio':
    $js .=  "if($".$prefix."('".$field['name'].":checked').length <= 0)
        { 
        msg += '<li>".$field['label']."'\\n</li>';
        err++;
        }";
    break;

(notice we've removed the curly brackets)

MichaelAllanson62 commented 10 years ago

Absolutely!

MichaelAllanson62 commented 10 years ago

I'm on it. I'll let you know the results shortly.

EvanHerman commented 10 years ago

Thanks!

We'll get it all sorted out for you. You may want to leave the file open as we'll probably need to make a few adjustments.

MichaelAllanson62 commented 10 years ago

The form responded this time, I'm waiting to make certain the info is posted to the MailChimp list.

EvanHerman commented 10 years ago

Ok great. Double check all the info was sent over. I'm working on setting up a new patch to push out that will resolve this issue.

I'm just setting up a local test environment/test forms as we speak

MichaelAllanson62 commented 10 years ago

I think it should have gone through by now and hasn't, so when I click submit it seems to submit the info, jumps me to the top of the page the form is on but the info is not being received by MailChimp.

EvanHerman commented 10 years ago

Ok, I've gone through some testing. This seems to work:

Copy from the case 'radio', down to and including the break;

case 'radio':
    $js .=  "if($".$prefix."('".$field['id'].":checked').length <= 0)
        { 
        msg += '<li>".$field['label']."\\n</li>';
        err++;
        $".$prefixa."('label[for=".$field['id']."]').next().find('input').addClass('yks_error_field_required shake animated').delay(800).queue(function(next){
                $".$prefixa."(this).removeClass('shake animated');
                next();
            });
        } else {
            $".$prefixa."('#".$field['id']."').removeClass('yks_error_field_required')
        }";
    break;

I created a duplicate form to what you have on your site and put it through some quick testing on a localhost installation. If the form is jumping back to the top of the page, or the page is refreshing, than there is a javascript error being thrown on the page and the info most likely isn't being transmitted over to MailChimp. If you have it set to single opt in it should go through almost immediately.

Update -- Give me a few minutes, even when a radio button is checked its reading as if it's not. Let me adjust one thing, I will let you know when I have updated it.

MichaelAllanson62 commented 10 years ago

This time I got an error "The following fields are required, and may not be left blank : Preferred Book Format" I checked and one of the options for "Preferred Book Format" is selected.

MichaelAllanson62 commented 10 years ago

Evan, do you dream in Java Script?

EvanHerman commented 10 years ago

Haha, sometimes. It depends what on my mind when I'm falling asleep :+1:

I'm just re-writing this small section that checks if a checkbox is selected. Currently it's reading as empty even if selected. Should only be a minute

EvanHerman commented 10 years ago

Alright Michael,

Can you give this one a shot? I had to change around a bit of the code to check if interest groups exist in for the list, so you may want to just.

First you'll want to replace the lines in the same file on 1393:

if ( isset($fd['interest-group-data']) ) {
    $interest_group_option = json_decode($fd['interest-group-data'], true);
}

Next, change line 1397:

if ( isset($interest_group_option) ) {

and then finally 1784-1796 (the radio button check that we edited before):

case 'radio':
    $js .=  "if($".$prefix."('.".$field['name'].":checked').length <= 0)
    { 
    msg += '<li>".$field['label']."\\n</li>';
    err++;
    $".$prefixa."('label[for=".$field['id']."]').next().find('input').addClass('yks_error_field_required shake animated').delay(800).queue(function(next){
            $".$prefixa."(this).removeClass('shake animated');
                next();
        });
    } else {
        $".$prefixa."('#".$field['id']."').removeClass('yks_error_field_required')
    }";
break;

Sorry that it was so much to change! If all works well, I will push out an update to the repository so all users get this patch.

MichaelAllanson62 commented 10 years ago

A few things, first, I can not see line numbers, is there a way to turn this on?

EvanHerman commented 10 years ago

It depends what text editor you're using.

Here's a direct link to the file. You can download it and just replace the entire file. I've uploaded it to my personal box account for easy access: https://app.box.com/s/mun9p6o53xq5fixrk8s7

MichaelAllanson62 commented 10 years ago

I don't appear to have software that will open the file.

EvanHerman commented 10 years ago

Let me push out an update to the repository so you can just update your plugin. It will just be easier for you that way.

MichaelAllanson62 commented 10 years ago

Right within wordpress

EvanHerman commented 10 years ago

You can probably open it with notepad. But I'm working on pushing out the update right now.

MichaelAllanson62 commented 10 years ago

Evan, thank you so much for your time on this.

MichaelAllanson62 commented 10 years ago

OK, I was able to open it. (Had to change the file extension to (.txt) Made the change and submitted a new form. This time I was given the confirmation message. Woohoo!

EvanHerman commented 10 years ago

Awesome!

Let me know if anything else seems off. I'm glad you opened up an issue here on Github and let us know of the trouble you were having. I'm sure other users in future would have faced similar problems.

Keep an eye out for the 4.3 version in the repository. It's going to be an updated version of the plugin with all of the changes we discussed here.

Thanks for being so patient while we worked out the issue!

MichaelAllanson62 commented 10 years ago

No, thank you! I appreciate your time and patience with me. You're a genius.

EvanHerman commented 10 years ago

I appreciate that! If you're enjoying the plugin and find it helpful we'd love a nice review in the repository http://wordpress.org/support/view/plugin-reviews/yikes-inc-easy-mailchimp-extender , it will only help the plugin become more visible and let others know how serious we are in maintaining it.

Thanks for using our plugin, and have a wonderful afternoon Michael!

P.S the 4.3 version should now be up and live in the repository

MichaelAllanson62 commented 10 years ago

Thank you Evan, I'll go leave a review now.