[0.5.x] Re-work on-change validation #105
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Precognition does its best to avoid sending requests when it does not need to. This might happen when the validation function has been called but the form's has not changed since the last validation attempt.
You could imagine a text input where the user changes a value and before leaving the field restores the original value. In that scenario there is no need to send a validation request as the form has not changed and the existing validation errors etc still makes sense.
This is the expected behaviour when you are validating a single field and the user is implicitly invoking the
validate
function.However, when building a wizard and calling
form.validate()
in a button without specifying a particular input to validate, you expect that the validation process will occur regardless of the state of the form so you are able to react to the response.The changes in this PR ensure the second scenario will send a validation request even when the form has not changed since the last validation attempt.