Skip to content

Commit e38e38e

Browse files
committed
feat: Enable individual precognitive fields
1 parent bd2d9f3 commit e38e38e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/vue-inertia/src/form.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,16 @@ export const Form = defineComponent({
4848
const shouldValidateField = (target: EventTarget | null) => {
4949
const el = target as HTMLElement | null
5050
if (!el) return false
51-
return props.precognitive === true || typeof props.precognitive === 'object' || el.hasAttribute?.('precognitive') || el.getAttribute?.('data-precognitive') === 'true'
51+
return (
52+
props.precognitive === true ||
53+
typeof props.precognitive === 'object' ||
54+
el.hasAttribute?.('precognitive') ||
55+
el.hasAttribute?.('data-precognitive') ||
56+
el.getAttribute?.('data-precognitive') === 'true'
57+
)
5258
}
5359

5460
const onMaybeValidate = (e: Event) => {
55-
if (!props.precognitive) return
5661
const evType = e.type as 'input' | 'change' | 'blur'
5762
const types = Array.isArray(props.validateOn) ? props.validateOn : [props.validateOn]
5863
if (!types.includes(evType)) return

0 commit comments

Comments
 (0)