Skip to content

Commit

Permalink
Check form.wpcf7.schema directly
Browse files Browse the repository at this point in the history
  • Loading branch information
takayukister committed Oct 19, 2022
1 parent 9907745 commit 871f616
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion includes/js/src/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function init( form ) {
unitTag: formData.get( '_wpcf7_unit_tag' ),
containerPost: absInt( formData.get( '_wpcf7_container_post' ) ),
parent: form.closest( '.wpcf7' ),
schema: {},
schema: undefined,
};

form.querySelectorAll( '.has-spinner' ).forEach( element => {
Expand Down
6 changes: 3 additions & 3 deletions includes/js/src/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { setStatus } from './status';
export default function validate( form, options = {} ) {
const scope = form;

const schema = { ...form.wpcf7?.schema };

if ( undefined === schema ) {
if ( undefined === form.wpcf7?.schema ) {
return;
}

const schema = { ...form.wpcf7.schema };

// Event target is not a wpcf7 form control.
if ( ! options.target?.closest( '.wpcf7-form-control-wrap[data-name]' ) ) {
return;
Expand Down

0 comments on commit 871f616

Please sign in to comment.