• I previously posted here about generic errors which prevented form submission when using multiple form/lists throughout a site.

    I’ve created a patch. These edits are all to the mailigen-widget.php file:

    around line 104 remove this line:

    
    $errors = $this->validate($fields);
    

    and add this line below the $listId declaration at about line 114:

    
    $errors = $this->validate($fields, $listId);
    

    Next around line 157 change the validate function declaration to:

    
    function validate($fields = array(), $selected_list = '') {
    

    Finally change this around line 160:

    
    $allFieldsParams = $this->getOption('mg_fields');
    

    to this:

    
    if( isset( $selected_list ) ) {
      $allFieldsParams = $this->getOption('mg_fields_'.$selected_list);
    }else{
      $allFieldsParams = $this->getOption('mg_fields');
    }
    

    This will effectively validate the fields that relate to the specific OptIn vs the generic list OptIn.

    Hope this helps.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mailigen

    (@krisjanisimedialv)

    Thanks @contemplate for the recommended changes, we will incorporate them in the widget as soon as possible.

    Thread Starter contemplate

    (@contemplate)

    Hi @krisjanisimedialv any update on when this will be implemented?

    Thread Starter contemplate

    (@contemplate)

    Can this please be updated!!

    Thread Starter contemplate

    (@contemplate)

    Ok one more addition to this edit.

    around line 188 change this:

    
    && !preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/', $value)
    

    to this:

    
    && !preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/', strtolower($value))
    

    This allows users to enter an email address with capital letters. A lot of users think that they need capital letters in their emails.

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

The topic ‘Fix for Validation Error when using multiple forms’ is closed to new replies.