When creating a signup form, fields that are marked as required in the mailchimp form are not marked as required in the Drupal form, except for the e-mail field, and do not provide HTML5 validation.

Radio buttons fields and interest groups show with a * (star) next to it, as if they were required, when they are not. Although the fields are marked with a star, the module lets you submit the form without filling them.

Comments

mrupsidown created an issue. See original summary.

mrupsidown’s picture

The fact that it adds the * (star) next to the field label seems to be a bug in the Bootstrap theme in the form-element-label.html.twig file in the if condition:

{%- if required and title_display == 'before' or title_display == 'after'-%}
  <span class="form-required">*</span>
{%- endif -%}

So please disregard this part of the issue.

The rest is still valid: A field marked as "required" in the Mailchimp form designer is not treated as required in the Drupal form and HTML5 validation is not available.

mrupsidown’s picture

Issue summary: View changes
asrob’s picture

helmo’s picture

Version: 8.x-1.1 » 8.x-1.x-dev

l also noticed this in 7.x-4.7 but fields like firstname and last name also work. Just not an extra field we have.

After some digging I discovered that of the two lists we offer to subscribe to on the form one had the field as required, the other did not.

The mergevars for various lists get merged in the code below. so only data from the last list that has this mergevar is used.

    $mergevar_settings = mailchimp_get_mergevars(array_filter($mc_lists));
    dsm($mergevar_settings);
    $form_state['mergevar_options'] = array();
    foreach ($mergevar_settings as $list_mergevars) {
      foreach ($list_mergevars as $mergevar) {
        $form_state['mergevar_options'][$mergevar->tag] = $mergevar;
        if (!$mergevar->public) {
          $form_state['mergevar_options'][$mergevar->tag]->name .= ' (private)';
        };
      }
    }

An option could be to add an extra if in here to check the 'required' value.

samuel.mortenson’s picture

Status: Active » Postponed (maintainer needs more info)

@helmo I was just looking into mailchimp_insert_drupal_form_tag() and it looks like we are respecting the required status of merge vars, is there another place I should be looking to see this bug?

gcb’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)