Title: Fix for Validation Error when using multiple forms
Last modified: October 4, 2017

---

# Fix for Validation Error when using multiple forms

 *  [contemplate](https://wordpress.org/support/users/contemplate/)
 * (@contemplate)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/fix-for-validation-error-when-using-multiple-forms/)
 * I previously posted [here](https://wordpress.org/support/topic/validation-broken-for-multiple-forms/)
   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](https://wordpress.org/support/users/krisjanisimedialv/)
 * (@krisjanisimedialv)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/fix-for-validation-error-when-using-multiple-forms/#post-9555826)
 * Thanks [@contemplate](https://wordpress.org/support/users/contemplate/) for the
   recommended changes, we will incorporate them in the widget as soon as possible.
 *  Thread Starter [contemplate](https://wordpress.org/support/users/contemplate/)
 * (@contemplate)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/fix-for-validation-error-when-using-multiple-forms/#post-9582111)
 * Hi [@krisjanisimedialv](https://wordpress.org/support/users/krisjanisimedialv/)
   any update on when this will be implemented?
 *  Thread Starter [contemplate](https://wordpress.org/support/users/contemplate/)
 * (@contemplate)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/fix-for-validation-error-when-using-multiple-forms/#post-9828109)
 * Can this please be updated!!
 *  Thread Starter [contemplate](https://wordpress.org/support/users/contemplate/)
 * (@contemplate)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/fix-for-validation-error-when-using-multiple-forms/#post-9828241)
 * 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.

 * ![](https://s.w.org/plugins/geopattern-icon/mailigen-widget_5244a9.svg)
 * [Mailigen Widget](https://wordpress.org/plugins/mailigen-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mailigen-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mailigen-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/mailigen-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mailigen-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mailigen-widget/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [contemplate](https://wordpress.org/support/users/contemplate/)
 * Last activity: [8 years, 4 months ago](https://wordpress.org/support/topic/fix-for-validation-error-when-using-multiple-forms/#post-9828241)
 * Status: not resolved