-
-
Notifications
You must be signed in to change notification settings - Fork 270
Open
Labels
Type: EnhancementEnhancements to features that already exist, but are not major additionsEnhancements to features that already exist, but are not major additions
Milestone
Description
Problem to Solve
In places where we want to have integration with other forms and stop them from submitting if there are invalid/required fields -- we want to be able to get at this information from inside and outside of DFV.
Proposed Solution
Add checkValidation and isValid methods to window.PodsDFV so that they can be called:
- Call
validationMessages = window.PodsDFV.checkValidation( pod, itemId, formCounter )
before submit to run validation rules on current values (even if they have not changed and triggered a validation yet) and passes back the list of validationMessages that can be displayed in a modal/alert or in Block Editor publish message section or something later when we are ready for that - Call
window.PodsDFV.isValid( pod, itemId, formCounter )
after runningcheckValidation()
to determine whether the form should be allowed to continue being submitted
Possible Workaround
Manually going through the field values from what we get from window.PodsDFV.getFieldValuesWithConfigs()
and checking whether required is on for the field and then confirming whether the field is empty.
It's not a great solution but that's what the jquery.pods.js
uses right now as a workaround for the submit()
handling.
Examples Elsewhere
No response
Screenshots / Screencast
No response
Metadata
Metadata
Assignees
Labels
Type: EnhancementEnhancements to features that already exist, but are not major additionsEnhancements to features that already exist, but are not major additions
Type
Projects
Status
🚦 Next Focus