You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Precognition enables real-time field validation as users type, providing immediate feedback without requiring a full form submission. This feature is only available when using HTMX mode.
7
+
8
+
## Prerequisites
9
+
10
+
1.**HTMX Mode**: Your form must use HTMX mode
11
+
2.**Idiomorph Extension**: Required for DOM morphing
12
+
13
+
Install [HTMX](https://htmx.org/) and the [Idiomorph extension](https://htmx.org/extensions/idiomorph/).
14
+
15
+
## Configuration
16
+
17
+
Enable precognition in your config:
18
+
19
+
```php
20
+
// site/config/config.php
21
+
22
+
return [
23
+
'tobimori.dreamform' => [
24
+
'mode' => 'htmx',
25
+
'precognition' => true,
26
+
],
27
+
];
28
+
```
29
+
30
+
## How It Works
31
+
32
+
- Fields validate automatically as users type or change values
33
+
- Text fields wait 500ms after typing stops before validating
34
+
- Select/radio/checkbox fields validate immediately on change
35
+
- Only the changed field is validated, not the entire form
36
+
- No data is saved during precognitive validation
37
+
38
+
## Partial Submissions
39
+
40
+
When precognition is enabled, you can also enable partial submissions:
41
+
42
+
```php
43
+
// site/config/config.php
44
+
45
+
return [
46
+
'tobimori.dreamform' => [
47
+
// ...
48
+
'partialSubmissions' => true,
49
+
],
50
+
];
51
+
```
52
+
This automatically saves each field's value as the user fills it out. This helps track progress for abandoned forms and prevents data loss from failed submissions.
0 commit comments