Skip to content

Commit 128f411

Browse files
committed
Dispatch in checkValidation #6898
1 parent fe3756f commit 128f411

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

ui/js/dfv/src/pods-dfv.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,25 @@ window.PodsDFV = {
611611
* @return {string[]} Array of validation messages
612612
*/
613613
checkValidation( pod, itemId, formCounter ) {
614-
const messages = [];
615-
return messages;
614+
const storeKey = createStoreKey(
615+
pod,
616+
itemId,
617+
formCounter,
618+
STORE_KEY_DFV
619+
);
620+
621+
const stored = select( storeKey );
622+
623+
// Store not found.
624+
if ( ! stored ) {
625+
return undefined;
626+
}
627+
//dispatch toggleNeedsValidating
628+
dispatch( storeKey ).toggleNeedsValidating();
629+
//select getValidationMessages
630+
const validationMessages = select( storeKey ).getValidationMessages();
631+
console.log( { validationMessages } );
632+
return validationMessages;
616633
},
617634

618635
/**

0 commit comments

Comments
 (0)