protected function validateStateAddress()
    {
        $field = 'state_id';
        $value = $this->getSubmitted($field);

        if (!isset($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('Country state');
        $format = $this->getCountryFormatAddress();

        if (empty($value) && !empty($format['state_id']['required'])) {
            $this->setErrorRequired($field, $label);
            return false;
        }

        if (!is_numeric($value)) {
            $this->setErrorNumeric($field, $label);
            return false;
        }

        if (empty($value)) {
            return true;
        }

        $state = $this->state->get($value);

        if (empty($state)) {
            $this->setErrorUnavailable($field, $label);
            return false;
        }

        return true;
    }
protected function validateStateAddress()
    {
        $field = 'state_id';
        $value = $this->getSubmitted($field);

        if (!isset($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('Country state');
        $format = $this->getCountryFormatAddress();

        if (empty($value) && !empty($format['state_id']['required'])) {
            $this->setErrorRequired($field, $label);
            return false;
        }

        if (!is_numeric($value)) {
            $this->setErrorNumeric($field, $label);
            return false;
        }

        if (empty($value)) {
            return true;
        }

        $state = $this->state->get($value);

        if (empty($state)) {
            $this->setErrorUnavailable($field, $label);
            return false;
        }

        return true;
    }
protected function validateStateAddress ( ) { $ field = 'state_id' ; $ value = $ this -> getSubmitted ( $ field ) ; if ( ! isset ( $ value ) ) { $ this -> unsetSubmitted ( $ field ) ; return null ; } $ label = $ this -> translation -> text ( 'Country state' ) ; $ format = $ this -> getCountryFormatAddress ( ) ; if ( empty ( $ value ) && ! empty ( $ format [ 'state_id' ] [ 'required' ] ) ) { $ this -> setErrorRequired ( $ field , $ label ) ; return false ; } if ( ! is_numeric ( $ value ) ) { $ this -> setErrorNumeric ( $ field , $ label ) ; return false ; } if ( empty ( $ value ) ) { return true ; } $ state = $ this -> state -> get ( $ value ) ; if ( empty ( $ state ) ) { $ this -> setErrorUnavailable ( $ field , $ label ) ; return false ; } return true ; }
Validates a country state
@return boolean|null
Validates a country state