Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter lucari

    (@lucari)

    @lapzor thank you for your availability!

    If I add the “Birthday” text input with MC4WP form builder button, the name is still “BIRTHDAY”. I tested it and it actually works, if the user writes their birthday in the DD/MM format, otherwise it returns 01/01.

    Because of this, I wanted to find a smart solution to avoid any user error (i.e. somebody could write MM/DD, somebody else could use dashes or dots instead of slashes, some other could write the name of the month… ) which would all return an incorrect date.

    I just came out with this solution:
    1 – the users inserts their birthday via a date input so that I am sure that it is set in the very same way for everyone; the input has no specific name;
    2 – Javascript converts the date input value to DD/MM and sends to a hidden field named “BIRTHDAY”
    3 – the date/text from “BIRTHDAY” hidden input is sent to MailChimp.

    This is the code I added: it might be better since I am not a programmer, but I tested it and it works fine!

      <input type="date" onchange="myDateFormat()" required="">
      <input type="hidden" id="showDate" name="BIRTHDAY">
    
      <script type="text/javascript">
        function myDateFormat() {
          var dateControl = document.querySelector('input[type="date"]');
          const [year, month, day] =       dateControl.value.split('-');
          const result = [day, month].join('/');
          document.getElementById("showDate").value = result;
    
        }
    
      </script>


    Thread Starter lucari

    (@lucari)

    @lapzor thanks for your reply.
    Unluckily, I get 01/01 with my own tests too.

    About the third example with two text inputs, I took the code from a custom HTML form generated in my Mailchimp account (Audience > Forms > Form Builder)
    The weird thing is that, if I try to embed this official HTML form, all the data is gathered properly, birthdays too. But I don’t want to keep the official form since it redirects users after subscription or errors, while MC4WP form works seamlessy.

    Thread Starter lucari

    (@lucari)

    Hello @lapzor and thank you so much, it worked like a charm!

    Thread Starter lucari

    (@lucari)

    Hello @lapzor and thank you for your reply.
    I did as you suggested:
    – set the list in MC4WP > Integration > Custom
    – emptied the log and set to log everything
    – made a new test

    but basically nothing changed, the user is correctly subscribed to MailChimp, but has no preference group. This is the log message:

    [2023-01-16 11:13:56]INFO:WooCommerce Checkout > Successfully subscribed prova-16-1-2023@pr***.pro
    Thread Starter lucari

    (@lucari)

    sure!
    In the log I can see these errors, but they don’t seem related to my issue

    [2022-04-27 12:33:24]ERROR:Form 104 > Mailchimp API error: 400 Bad Request. Member Exists. ceru********@gm***.com is already a list member. Use PUT to insert or update list members.
    
    Request:
    
    POST https://us1.api.mailchimp.com/3.0/lists/7842b12821/members
    
    {"status":"pending","email_address":"ceru********@gm***.com","interests":{},"merge_fields":{},"email_type":"html","ip_signup":"188.14.57.243","tags":[]}
    
    Response:
    
    400 Bad Request
    
    {"title":"Member Exists","status":400,"detail":"ceru********@gm***.com is already a list member. Use PUT to insert or update list members.","instance":"481499c2-8e95-5f26-8588-3385be367fb9"}

    Very old message, it looks like a member tried to sign up more than once.

    [2023-01-08 07:27:01]ERROR:Form 104 > Mailchimp API error: 400 Bad Request. Invalid Resource. hich**@pr**********.ru has signed up to a lot of lists very recently; we're not allowing more signups for now
    
    Request:
    
    POST https://us1.api.mailchimp.com/3.0/lists/7842b12821/members
    
    {"status":"subscribed","email_address":"hich**@pr**********.ru","interests":{},"merge_fields":{},"email_type":"html","ip_signup":"213.142.147.251","tags":[]}
    
    Response:
    
    400 Bad Request
    
    {"type":"https://mailchimp.com/developer/marketing/docs/errors/","title":"Invalid Resource","status":400,"detail":"hich**@pr**********.ru has signed up to a lot of lists very recently; we're not allowing more signups for now","instance":"5ae2a540-88f1-4706-a4e7-c5474c4577d6"}
    

    Quite similar to the previous one, but this looks more like a bot-related issue.

    
    [2023-01-12 17:56:49]WARNING:Custom > No Mailchimp lists were selected
    
    [2023-01-12 18:02:23]WARNING:Custom > No Mailchimp lists were selected
    
    [2023-01-12 18:02:35]WARNING:Custom > No Mailchimp lists were selected

    These three displayed exactly when I was setting up the form and testing it. I noticed that I had selected no lists in MC4WP > Integrations > WooCommerce Checkout, which I did immediately after, and now these are my settings: https://ibb.co/bKxz21T

    Right now I checked once again all the IDs I used in my custom code, and they are correct, as I took the HTML from a form created with MC4WP (visible in the footer) which is working fine, and I just made little tweaks like adding the prefix mc4wp- to my input names

    <input name="mc4wp-INTERESTS[...]"

    I have the same issue and I managed to check the image size via jQuery (with a differend script than @codekraft ‘s one), and eventually display a custom error message right under the field.
    But what I get is just a deterrent, not an effective invalidation of the field; if visitors ignore my error message, they can submit the form anyway.
    How can we really invalidate the field in the CF7 way so that, if somebody tries to submit a form with low-res images, they cannot?

    Thread Starter lucari

    (@lucari)

    @etruel thank you so much, it worked like a charm!
    if anyone had the same issue, this is how I did it:

    1. in the original website/domain, export posts via in Tools > Export; there you can also choose to export WPE Campaigns
    2. go to the new website/domain, import only your campaigns or create a new one manually
    3. After you created or imported your campaigns in the new website/domain, note down the campaigns IDs
    4. get back to the XML export file from the original website/domain and look for strings like this
      <wp:meta_key><![CDATA[wpe_campaignid]]></wp:meta_key>
      <wp:meta_value><![CDATA[123]]></wp:meta_value>

      where 123 is the campaign ID. If the new campaigns have different IDs compared to the original domain, simply change it with your favourite text/code editor.

    5. Import the edited XML via Tools > Import and you’re done!
    Thread Starter lucari

    (@lucari)

    Thank you so much @lapzor , I got it working!
    in the end I used this code

    mc4wp.forms.on('success', function(form, data) {
      if (JSON.stringify(data).includes('bce4fef6f2')){ /*'bce4fef6f2' is the value of the checkbox that allows redirect */
        	window.location.href = "https://www.pinkarman.com/thank-you/";
      }
    Thread Starter lucari

    (@lucari)

    @lapzor thanks a lot!
    The basic Javascript redirect works great,
    without the plugin settings redirection, and with just a little tweak in the code:

    window.location.href = "https://www.pinkarman.com/thank-you/";
    (I had to change the brackets to an equals sign)

    But the conditions are not working: I fear that, as soon as the “success” event is triggered, the form is cleared, so the checkbox is not checked anymore.
    Have you got any ideas?

    Thread Starter lucari

    (@lucari)

    @hchouhan thank you,
    actually I saw that the main settings allow only one redirect rule for any form and any condition, but I was wondering if it is possible to use JavaScript form events like

    mc4wp.forms.on('success', function() {
    var checkBox = document.querySelectorAll("[value=9f456824c8]");
      if (checkBox.checked == true){
    window.location.replace("https://www.pinkarman.com/thank-you/");
    }
    });

    which is not working

Viewing 10 replies - 1 through 10 (of 10 total)