brandaid / dancenetwork

Front-End Presentational Markup
0 stars 0 forks source link

Emma form integration #1

Closed nerdpruitt closed 9 years ago

nerdpruitt commented 9 years ago

Use this bad boy - https://gist.github.com/nerdpruitt/59fa0a9c77431ea15ba9

nerdpruitt commented 9 years ago

From the Hemingway site, for future reference.

$('#btnContactSubmit').click(function () {
    if ($('input[name="emma_member_email"]').val() == '' || $('input[name="emma_member_email"]').val() == 'JOIN OUR MAILING LIST') {
        contactError.html('Please provide an email');
    } else {
        var userEmail = $('input[name="emma_member_email"]').val(); 
        if (validateEmail(userEmail)) {
            //iterate pathname so we can find where the emma script is...
            var depthString = '', depth = 0, pathname = document.location.pathname;
            for (var i = 0; i < pathname.length; i++)
            {
            if (pathname[i] === '/') {
                    depth++;
                    if (depth > 1) {
                        depthString += '../';
                    }
                }
            }
            $.ajax({
                type: 'POST',
                url: depthString + '_themes/hemingway/emma.php',
                data: {
                    'email': userEmail,
                    'name': 'none'
                },
                success: function (data) {
                    var obj = JSON.parse(data);
                    if (obj.status == 'a') {
                        contactError.html('SUCCESS! THANK YOU!');
                    } else {
                        contactError.html('We are sorry, there was an error with your submission.');
                    }
                },
                error: function (xhr) {
                    contactError.html('We are sorry, but there was an error.');
                }
            });
        } else {
            contactError.html('Is this a valid email?');
        }
    }
});
jeremymansfield commented 9 years ago

I just realized I did not create a group within EMMA for the sign-ups to go to. So not sure if this is working yet. Just created a group called "Web Signup".

nerdpruitt commented 9 years ago

I had it pointing to Test Group, and it was working.

jeremymansfield commented 9 years ago

Just checked and there were no entries in the Test Group. Can we please switch to "Web Signup"?

When I fill out the form and hit submit (Let's Dance), nothing happens on the live site. This is where I'll need some help on the validation and getting a success or thank you message?

nerdpruitt commented 9 years ago

I deleted my entries when I was done. It looks like something broke with it though...

nerdpruitt commented 9 years ago

Looks like it’s not working in Safari specifically. Chrome is good. I'll try some others too

nerdpruitt commented 9 years ago

Okay, found it...kick the tires a bit. Your contacts should be showing up now.

jeremymansfield commented 9 years ago

Perfect.

jeremymansfield commented 9 years ago

Flamenco was spelled wrong on the EMMA side, and it's been corrected. I'm not seeing the change on the front-side with the site however. I am assuming this would change automatically, correct? Or is there anything you need to do?

screen shot 2015-02-20 at 2 12 11 pm

nerdpruitt commented 9 years ago

Yeah, I'll have to update the HTML.

nerdpruitt commented 9 years ago

https://github.com/brandaid/dancenetwork/commit/588db7a4a1663b384f16267ccdf0801c8f871890