Browse Source

Corrige validação de campos opcionais

master
Guilherme Capanema 6 years ago
parent
commit
35dbc7c6c8
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      public/class-cf7-states-cities-public.php

+ 2
- 2
public/class-cf7-states-cities-public.php View File

@ -274,7 +274,7 @@ class Cf7_States_Cities_Public {
$result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) );
}
if ( $tag->type === 'state' || $tag->type === 'state*' ) {
if ( !$empty && ( $tag->type === 'state' || $tag->type === 'state*' ) ) {
$states = require( plugin_dir_path( __FILE__ ) . '../data/states.php' );
if ( !in_array( $_POST[$name], $states ) ) {
@ -282,7 +282,7 @@ class Cf7_States_Cities_Public {
}
}
if ( $tag->type === 'city' || $tag->type === 'city*' ) {
if ( !$empty && ( $tag->type === 'city' || $tag->type === 'city*' ) ) {
$cities = require( plugin_dir_path( __FILE__ ) . '../data/cities.php' );
if ( !in_array( $_POST[$name], $cities ) ) {


Loading…
Cancel
Save