Skip to content

Conversation

@likeadeckofcards
Copy link

By calling form.validate() on a form that has not had any changes will force add the the Precognition-Validate-Only header to the async request and will be an empty string. Laravel on the backend checks that this header is preset and then uses it value to filter the validation rules down to only the fields present in this header. If this header is an empty string this will result in all fields being filtered out of the validation. By adding the Array.from(only) will convert ArrayLike and Iterable types into an array object, which fixes the ternary statement to resolve to the correct object.

Fixes #124

@timacdonald
Copy link
Member

Thanks for the PR. I'm going to close this one for now as this is the intended behaviour.

If you are building a wizard and want to validate fields that have not been interacted with, I recommend using the approaches I mentioned in #124 (comment)

@timacdonald timacdonald closed this Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot validate whole form without only config

2 participants