Deployed 59ff7f1 to 5.4 with MkDocs 1.1.2 and mike 0.5.5
[GitHub/WoltLab/woltlab.github.io.git] / latest / php / api / form_builder / validation_data / index.html
1
2 <!doctype html>
3 <html lang="en" class="no-js">
4 <head>
5
6 <meta charset="utf-8">
7 <meta name="viewport" content="width=device-width,initial-scale=1">
8
9
10
11
12 <link rel="icon" href="../../../../assets/default.favicon.ico">
13 <meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.0">
14
15
16
17 <title>Validation and Data - WoltLab Suite Documentation</title>
18
19
20
21 <link rel="stylesheet" href="../../../../assets/stylesheets/main.33e2939f.min.css">
22
23
24 <link rel="stylesheet" href="../../../../assets/stylesheets/palette.ef6f36e2.min.css">
25
26
27
28 <meta name="theme-color" content="#009485">
29
30
31
32
33
34
35
36
37
38 <link rel="stylesheet" href="../../../../stylesheets/extra.css">
39
40
41
42
43
44 </head>
45
46
47
48
49
50
51
52 <body dir="ltr" data-md-color-scheme="" data-md-color-primary="teal" data-md-color-accent="">
53
54
55 <script>function __prefix(e){return new URL("../../../..",location).pathname+"."+e}function __get(e,t=localStorage){return JSON.parse(t.getItem(__prefix(e)))}</script>
56
57 <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
58 <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
59 <label class="md-overlay" for="__drawer"></label>
60 <div data-md-component="skip">
61
62
63 <a href="#form-validation-and-form-data" class="md-skip">
64 Skip to content
65 </a>
66
67 </div>
68 <div data-md-component="announce">
69
70 <aside class="md-announce">
71 <div class="md-announce__inner md-grid md-typeset">
72
73 <a href="https://www.woltlab.com">Back to <strong>woltlab.com</strong></a>
74
75 </div>
76 </aside>
77
78 </div>
79
80 <header class="md-header" data-md-component="header">
81 <nav class="md-header__inner md-grid" aria-label="Header">
82 <a href="../../../.." title="WoltLab Suite Documentation" class="md-header__button md-logo" aria-label="WoltLab Suite Documentation" data-md-component="logo">
83
84 <img src="../../../../assets/logo.png" alt="logo">
85
86 </a>
87 <label class="md-header__button md-icon" for="__drawer">
88 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg>
89 </label>
90 <div class="md-header__title" data-md-component="header-title">
91 <div class="md-header__ellipsis">
92 <div class="md-header__topic">
93 <span class="md-ellipsis">
94 WoltLab Suite Documentation
95 </span>
96 </div>
97 <div class="md-header__topic" data-md-component="header-topic">
98 <span class="md-ellipsis">
99
100 Validation and Data
101
102 </span>
103 </div>
104 </div>
105 </div>
106
107
108
109 <label class="md-header__button md-icon" for="__search">
110 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
111 </label>
112
113 <div class="md-search" data-md-component="search" role="dialog">
114 <label class="md-search__overlay" for="__search"></label>
115 <div class="md-search__inner" role="search">
116 <form class="md-search__form" name="search">
117 <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" data-md-state="active" required>
118 <label class="md-search__icon md-icon" for="__search">
119 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
120 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
121 </label>
122 <button type="reset" class="md-search__icon md-icon" aria-label="Clear" tabindex="-1">
123 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>
124 </button>
125 </form>
126 <div class="md-search__output">
127 <div class="md-search__scrollwrap" data-md-scrollfix>
128 <div class="md-search-result" data-md-component="search-result">
129 <div class="md-search-result__meta">
130 Initializing search
131 </div>
132 <ol class="md-search-result__list"></ol>
133 </div>
134 </div>
135 </div>
136 </div>
137 </div>
138
139
140 <div class="md-header__source">
141
142 <a href="https://github.com/WoltLab/docs.woltlab.com/" title="Go to repository" class="md-source" data-md-component="source">
143 <div class="md-source__icon md-icon">
144
145 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
146 </div>
147 <div class="md-source__repository">
148 GitHub
149 </div>
150 </a>
151 </div>
152
153 </nav>
154 </header>
155
156 <div class="md-container" data-md-component="container">
157
158
159
160
161 <main class="md-main" data-md-component="main">
162 <div class="md-main__inner md-grid">
163
164
165
166 <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
167 <div class="md-sidebar__scrollwrap">
168 <div class="md-sidebar__inner">
169
170
171
172 <nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
173 <label class="md-nav__title" for="__drawer">
174 <a href="../../../.." title="WoltLab Suite Documentation" class="md-nav__button md-logo" aria-label="WoltLab Suite Documentation" data-md-component="logo">
175
176 <img src="../../../../assets/logo.png" alt="logo">
177
178 </a>
179 WoltLab Suite Documentation
180 </label>
181
182 <div class="md-nav__source">
183
184 <a href="https://github.com/WoltLab/docs.woltlab.com/" title="Go to repository" class="md-source" data-md-component="source">
185 <div class="md-source__icon md-icon">
186
187 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
188 </div>
189 <div class="md-source__repository">
190 GitHub
191 </div>
192 </a>
193 </div>
194
195 <ul class="md-nav__list" data-md-scrollfix>
196
197
198
199
200
201
202
203
204 <li class="md-nav__item">
205 <a href="../../../../getting-started/" class="md-nav__link">
206 Getting Started
207 </a>
208 </li>
209
210
211
212
213
214
215
216
217
218
219
220
221
222 <li class="md-nav__item md-nav__item--active md-nav__item--nested">
223
224
225 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_2" type="checkbox" id="__nav_2" checked>
226
227 <label class="md-nav__link" for="__nav_2">
228 PHP API
229 <span class="md-nav__icon md-icon"></span>
230 </label>
231 <nav class="md-nav" aria-label="PHP API" data-md-level="1">
232 <label class="md-nav__title" for="__nav_2">
233 <span class="md-nav__icon md-icon"></span>
234 PHP API
235 </label>
236 <ul class="md-nav__list" data-md-scrollfix>
237
238
239
240
241
242 <li class="md-nav__item">
243 <a href="../../../pages/" class="md-nav__link">
244 Pages
245 </a>
246 </li>
247
248
249
250
251
252
253
254 <li class="md-nav__item">
255 <a href="../../../database-objects/" class="md-nav__link">
256 Database Objects
257 </a>
258 </li>
259
260
261
262
263
264
265
266 <li class="md-nav__item">
267 <a href="../../../database-access/" class="md-nav__link">
268 Database Access
269 </a>
270 </li>
271
272
273
274
275
276
277
278 <li class="md-nav__item">
279 <a href="../../../exceptions/" class="md-nav__link">
280 Exceptions
281 </a>
282 </li>
283
284
285
286
287
288
289
290
291
292
293 <li class="md-nav__item md-nav__item--active md-nav__item--nested">
294
295
296 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_2_5" type="checkbox" id="__nav_2_5" checked>
297
298 <label class="md-nav__link" for="__nav_2_5">
299 API
300 <span class="md-nav__icon md-icon"></span>
301 </label>
302 <nav class="md-nav" aria-label="API" data-md-level="2">
303 <label class="md-nav__title" for="__nav_2_5">
304 <span class="md-nav__icon md-icon"></span>
305 API
306 </label>
307 <ul class="md-nav__list" data-md-scrollfix>
308
309
310
311
312
313
314 <li class="md-nav__item md-nav__item--nested">
315
316
317 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_2_5_1" type="checkbox" id="__nav_2_5_1" >
318
319 <label class="md-nav__link" for="__nav_2_5_1">
320 Caches
321 <span class="md-nav__icon md-icon"></span>
322 </label>
323 <nav class="md-nav" aria-label="Caches" data-md-level="3">
324 <label class="md-nav__title" for="__nav_2_5_1">
325 <span class="md-nav__icon md-icon"></span>
326 Caches
327 </label>
328 <ul class="md-nav__list" data-md-scrollfix>
329
330
331
332
333
334 <li class="md-nav__item">
335 <a href="../../caches/" class="md-nav__link">
336 Overview
337 </a>
338 </li>
339
340
341
342
343
344
345
346 <li class="md-nav__item">
347 <a href="../../caches_persistent-caches/" class="md-nav__link">
348 Persistent Caches
349 </a>
350 </li>
351
352
353
354
355
356
357
358 <li class="md-nav__item">
359 <a href="../../caches_runtime-caches/" class="md-nav__link">
360 Runtime Caches
361 </a>
362 </li>
363
364
365
366 </ul>
367 </nav>
368 </li>
369
370
371
372
373
374
375
376 <li class="md-nav__item">
377 <a href="../../comments/" class="md-nav__link">
378 Comments
379 </a>
380 </li>
381
382
383
384
385
386
387
388 <li class="md-nav__item">
389 <a href="../../cronjobs/" class="md-nav__link">
390 Cronjobs
391 </a>
392 </li>
393
394
395
396
397
398
399
400 <li class="md-nav__item">
401 <a href="../../events/" class="md-nav__link">
402 Events
403 </a>
404 </li>
405
406
407
408
409
410
411
412
413
414
415 <li class="md-nav__item md-nav__item--active md-nav__item--nested">
416
417
418 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_2_5_5" type="checkbox" id="__nav_2_5_5" checked>
419
420 <label class="md-nav__link" for="__nav_2_5_5">
421 Form Builder
422 <span class="md-nav__icon md-icon"></span>
423 </label>
424 <nav class="md-nav" aria-label="Form Builder" data-md-level="3">
425 <label class="md-nav__title" for="__nav_2_5_5">
426 <span class="md-nav__icon md-icon"></span>
427 Form Builder
428 </label>
429 <ul class="md-nav__list" data-md-scrollfix>
430
431
432
433
434
435 <li class="md-nav__item">
436 <a href="../overview/" class="md-nav__link">
437 Overview
438 </a>
439 </li>
440
441
442
443
444
445
446
447 <li class="md-nav__item">
448 <a href="../structure/" class="md-nav__link">
449 Structure
450 </a>
451 </li>
452
453
454
455
456
457
458
459 <li class="md-nav__item">
460 <a href="../form_fields/" class="md-nav__link">
461 Fields
462 </a>
463 </li>
464
465
466
467
468
469
470
471
472
473 <li class="md-nav__item md-nav__item--active">
474
475 <input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
476
477
478
479
480 <label class="md-nav__link md-nav__link--active" for="__toc">
481 Validation and Data
482 <span class="md-nav__icon md-icon"></span>
483 </label>
484
485 <a href="./" class="md-nav__link md-nav__link--active">
486 Validation and Data
487 </a>
488
489
490 <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
491
492
493
494
495
496 <label class="md-nav__title" for="__toc">
497 <span class="md-nav__icon md-icon"></span>
498 Table of contents
499 </label>
500 <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
501
502 <li class="md-nav__item">
503 <a href="#form-validation" class="md-nav__link">
504 Form Validation
505 </a>
506
507 <nav class="md-nav" aria-label="Form Validation">
508 <ul class="md-nav__list">
509
510 <li class="md-nav__item">
511 <a href="#iformfieldvalidationerror-formfieldvalidationerror" class="md-nav__link">
512 IFormFieldValidationError / FormFieldValidationError
513 </a>
514
515 </li>
516
517 <li class="md-nav__item">
518 <a href="#iformfieldvalidator-formfieldvalidator" class="md-nav__link">
519 IFormFieldValidator / FormFieldValidator
520 </a>
521
522 </li>
523
524 </ul>
525 </nav>
526
527 </li>
528
529 <li class="md-nav__item">
530 <a href="#form-data" class="md-nav__link">
531 Form Data
532 </a>
533
534 <nav class="md-nav" aria-label="Form Data">
535 <ul class="md-nav__list">
536
537 <li class="md-nav__item">
538 <a href="#iformdatahandler-formdatahandler" class="md-nav__link">
539 IFormDataHandler / FormDataHandler
540 </a>
541
542 </li>
543
544 <li class="md-nav__item">
545 <a href="#iformdataprocessor-defaultformdataprocessor" class="md-nav__link">
546 IFormDataProcessor / DefaultFormDataProcessor
547 </a>
548
549 </li>
550
551 <li class="md-nav__item">
552 <a href="#additional-data-processors" class="md-nav__link">
553 Additional Data Processors
554 </a>
555
556 <nav class="md-nav" aria-label="Additional Data Processors">
557 <ul class="md-nav__list">
558
559 <li class="md-nav__item">
560 <a href="#customformdataprocessor" class="md-nav__link">
561 CustomFormDataProcessor
562 </a>
563
564 </li>
565
566 <li class="md-nav__item">
567 <a href="#voidformdataprocessor" class="md-nav__link">
568 VoidFormDataProcessor
569 </a>
570
571 </li>
572
573 </ul>
574 </nav>
575
576 </li>
577
578 </ul>
579 </nav>
580
581 </li>
582
583 </ul>
584
585 </nav>
586
587 </li>
588
589
590
591
592
593
594
595 <li class="md-nav__item">
596 <a href="../dependencies/" class="md-nav__link">
597 Dependencies
598 </a>
599 </li>
600
601
602
603 </ul>
604 </nav>
605 </li>
606
607
608
609
610
611
612
613 <li class="md-nav__item">
614 <a href="../../package_installation_plugins/" class="md-nav__link">
615 Package Installation Plugins
616 </a>
617 </li>
618
619
620
621
622
623
624
625 <li class="md-nav__item">
626 <a href="../../user_activity_points/" class="md-nav__link">
627 User Activity Points
628 </a>
629 </li>
630
631
632
633
634
635
636
637 <li class="md-nav__item">
638 <a href="../../user_notifications/" class="md-nav__link">
639 User Notifications
640 </a>
641 </li>
642
643
644
645
646
647
648
649 <li class="md-nav__item">
650 <a href="../../sitemaps/" class="md-nav__link">
651 Sitemaps
652 </a>
653 </li>
654
655
656
657 </ul>
658 </nav>
659 </li>
660
661
662
663
664
665
666
667 <li class="md-nav__item">
668 <a href="../../../code-style/" class="md-nav__link">
669 Code Style
670 </a>
671 </li>
672
673
674
675
676
677
678
679 <li class="md-nav__item">
680 <a href="../../../apps/" class="md-nav__link">
681 Apps
682 </a>
683 </li>
684
685
686
687
688
689
690
691 <li class="md-nav__item">
692 <a href="../../../gdpr/" class="md-nav__link">
693 GDPR
694 </a>
695 </li>
696
697
698
699 </ul>
700 </nav>
701 </li>
702
703
704
705
706
707
708
709
710
711
712
713 <li class="md-nav__item md-nav__item--nested">
714
715
716 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_3" type="checkbox" id="__nav_3" >
717
718 <label class="md-nav__link" for="__nav_3">
719 Languages, Templates & CSS
720 <span class="md-nav__icon md-icon"></span>
721 </label>
722 <nav class="md-nav" aria-label="Languages, Templates & CSS" data-md-level="1">
723 <label class="md-nav__title" for="__nav_3">
724 <span class="md-nav__icon md-icon"></span>
725 Languages, Templates & CSS
726 </label>
727 <ul class="md-nav__list" data-md-scrollfix>
728
729
730
731
732
733 <li class="md-nav__item">
734 <a href="../../../../view/languages/" class="md-nav__link">
735 Languages
736 </a>
737 </li>
738
739
740
741
742
743
744
745 <li class="md-nav__item">
746 <a href="../../../../view/templates/" class="md-nav__link">
747 Templates
748 </a>
749 </li>
750
751
752
753
754
755
756
757 <li class="md-nav__item">
758 <a href="../../../../view/template-plugins/" class="md-nav__link">
759 Template Plugins
760 </a>
761 </li>
762
763
764
765
766
767
768
769 <li class="md-nav__item">
770 <a href="../../../../view/css/" class="md-nav__link">
771 CSS
772 </a>
773 </li>
774
775
776
777 </ul>
778 </nav>
779 </li>
780
781
782
783
784
785
786
787
788
789
790
791 <li class="md-nav__item md-nav__item--nested">
792
793
794 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_4" type="checkbox" id="__nav_4" >
795
796 <label class="md-nav__link" for="__nav_4">
797 TypeScript and JavaScript API
798 <span class="md-nav__icon md-icon"></span>
799 </label>
800 <nav class="md-nav" aria-label="TypeScript and JavaScript API" data-md-level="1">
801 <label class="md-nav__title" for="__nav_4">
802 <span class="md-nav__icon md-icon"></span>
803 TypeScript and JavaScript API
804 </label>
805 <ul class="md-nav__list" data-md-scrollfix>
806
807
808
809
810
811 <li class="md-nav__item">
812 <a href="../../../../javascript/general-usage/" class="md-nav__link">
813 General Usage
814 </a>
815 </li>
816
817
818
819
820
821
822
823 <li class="md-nav__item">
824 <a href="../../../../javascript/typescript/" class="md-nav__link">
825 TypeScript
826 </a>
827 </li>
828
829
830
831
832
833
834
835
836 <li class="md-nav__item md-nav__item--nested">
837
838
839 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_4_3" type="checkbox" id="__nav_4_3" >
840
841 <label class="md-nav__link" for="__nav_4_3">
842 New API
843 <span class="md-nav__icon md-icon"></span>
844 </label>
845 <nav class="md-nav" aria-label="New API" data-md-level="2">
846 <label class="md-nav__title" for="__nav_4_3">
847 <span class="md-nav__icon md-icon"></span>
848 New API
849 </label>
850 <ul class="md-nav__list" data-md-scrollfix>
851
852
853
854
855
856 <li class="md-nav__item">
857 <a href="../../../../javascript/new-api_writing-a-module/" class="md-nav__link">
858 Writing a module
859 </a>
860 </li>
861
862
863
864
865
866
867
868 <li class="md-nav__item">
869 <a href="../../../../javascript/new-api_data-structures/" class="md-nav__link">
870 Data Structures
871 </a>
872 </li>
873
874
875
876
877
878
879
880 <li class="md-nav__item">
881 <a href="../../../../javascript/new-api_core/" class="md-nav__link">
882 Core Functions
883 </a>
884 </li>
885
886
887
888
889
890
891
892 <li class="md-nav__item">
893 <a href="../../../../javascript/new-api_dom/" class="md-nav__link">
894 DOM
895 </a>
896 </li>
897
898
899
900
901
902
903
904 <li class="md-nav__item">
905 <a href="../../../../javascript/new-api_events/" class="md-nav__link">
906 Event Handling
907 </a>
908 </li>
909
910
911
912
913
914
915
916 <li class="md-nav__item">
917 <a href="../../../../javascript/new-api_ajax/" class="md-nav__link">
918 Ajax
919 </a>
920 </li>
921
922
923
924
925
926
927
928 <li class="md-nav__item">
929 <a href="../../../../javascript/new-api_dialogs/" class="md-nav__link">
930 Dialogs
931 </a>
932 </li>
933
934
935
936
937
938
939
940 <li class="md-nav__item">
941 <a href="../../../../javascript/new-api_browser/" class="md-nav__link">
942 Browser and Screen Sizes
943 </a>
944 </li>
945
946
947
948
949
950
951
952 <li class="md-nav__item">
953 <a href="../../../../javascript/new-api_ui/" class="md-nav__link">
954 User Interface
955 </a>
956 </li>
957
958
959
960 </ul>
961 </nav>
962 </li>
963
964
965
966
967
968
969
970 <li class="md-nav__item">
971 <a href="../../../../javascript/legacy-api/" class="md-nav__link">
972 Legacy API
973 </a>
974 </li>
975
976
977
978
979
980
981
982 <li class="md-nav__item">
983 <a href="../../../../javascript/helper-functions/" class="md-nav__link">
984 Helper Functions
985 </a>
986 </li>
987
988
989
990
991
992
993
994 <li class="md-nav__item">
995 <a href="../../../../javascript/code-snippets/" class="md-nav__link">
996 Code Snippets
997 </a>
998 </li>
999
1000
1001
1002 </ul>
1003 </nav>
1004 </li>
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016 <li class="md-nav__item md-nav__item--nested">
1017
1018
1019 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_5" type="checkbox" id="__nav_5" >
1020
1021 <label class="md-nav__link" for="__nav_5">
1022 Package Components
1023 <span class="md-nav__icon md-icon"></span>
1024 </label>
1025 <nav class="md-nav" aria-label="Package Components" data-md-level="1">
1026 <label class="md-nav__title" for="__nav_5">
1027 <span class="md-nav__icon md-icon"></span>
1028 Package Components
1029 </label>
1030 <ul class="md-nav__list" data-md-scrollfix>
1031
1032
1033
1034
1035
1036 <li class="md-nav__item">
1037 <a href="../../../../package/package-xml/" class="md-nav__link">
1038 package.xml
1039 </a>
1040 </li>
1041
1042
1043
1044
1045
1046
1047
1048
1049 <li class="md-nav__item md-nav__item--nested">
1050
1051
1052 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_5_2" type="checkbox" id="__nav_5_2" >
1053
1054 <label class="md-nav__link" for="__nav_5_2">
1055 PIPs
1056 <span class="md-nav__icon md-icon"></span>
1057 </label>
1058 <nav class="md-nav" aria-label="PIPs" data-md-level="2">
1059 <label class="md-nav__title" for="__nav_5_2">
1060 <span class="md-nav__icon md-icon"></span>
1061 PIPs
1062 </label>
1063 <ul class="md-nav__list" data-md-scrollfix>
1064
1065
1066
1067
1068
1069 <li class="md-nav__item">
1070 <a href="../../../../package/pip/" class="md-nav__link">
1071 Overview
1072 </a>
1073 </li>
1074
1075
1076
1077
1078
1079
1080
1081 <li class="md-nav__item">
1082 <a href="../../../../package/pip/acl-option/" class="md-nav__link">
1083 aclOption
1084 </a>
1085 </li>
1086
1087
1088
1089
1090
1091
1092
1093 <li class="md-nav__item">
1094 <a href="../../../../package/pip/acp-menu/" class="md-nav__link">
1095 acpMenu
1096 </a>
1097 </li>
1098
1099
1100
1101
1102
1103
1104
1105 <li class="md-nav__item">
1106 <a href="../../../../package/pip/acp-search-provider/" class="md-nav__link">
1107 acpSearchProvider
1108 </a>
1109 </li>
1110
1111
1112
1113
1114
1115
1116
1117 <li class="md-nav__item">
1118 <a href="../../../../package/pip/acp-template/" class="md-nav__link">
1119 acpTemplate
1120 </a>
1121 </li>
1122
1123
1124
1125
1126
1127
1128
1129 <li class="md-nav__item">
1130 <a href="../../../../package/pip/bbcode/" class="md-nav__link">
1131 bbcode
1132 </a>
1133 </li>
1134
1135
1136
1137
1138
1139
1140
1141 <li class="md-nav__item">
1142 <a href="../../../../package/pip/box/" class="md-nav__link">
1143 box
1144 </a>
1145 </li>
1146
1147
1148
1149
1150
1151
1152
1153 <li class="md-nav__item">
1154 <a href="../../../../package/pip/clipboard-action/" class="md-nav__link">
1155 clipboardAction
1156 </a>
1157 </li>
1158
1159
1160
1161
1162
1163
1164
1165 <li class="md-nav__item">
1166 <a href="../../../../package/pip/core-object/" class="md-nav__link">
1167 coreObject
1168 </a>
1169 </li>
1170
1171
1172
1173
1174
1175
1176
1177 <li class="md-nav__item">
1178 <a href="../../../../package/pip/cronjob/" class="md-nav__link">
1179 cronjob
1180 </a>
1181 </li>
1182
1183
1184
1185
1186
1187
1188
1189 <li class="md-nav__item">
1190 <a href="../../../../package/pip/database/" class="md-nav__link">
1191 database
1192 </a>
1193 </li>
1194
1195
1196
1197
1198
1199
1200
1201 <li class="md-nav__item">
1202 <a href="../../../../package/pip/event-listener/" class="md-nav__link">
1203 eventListener
1204 </a>
1205 </li>
1206
1207
1208
1209
1210
1211
1212
1213 <li class="md-nav__item">
1214 <a href="../../../../package/pip/file/" class="md-nav__link">
1215 file
1216 </a>
1217 </li>
1218
1219
1220
1221
1222
1223
1224
1225 <li class="md-nav__item">
1226 <a href="../../../../package/pip/language/" class="md-nav__link">
1227 language
1228 </a>
1229 </li>
1230
1231
1232
1233
1234
1235
1236
1237 <li class="md-nav__item">
1238 <a href="../../../../package/pip/media-provider/" class="md-nav__link">
1239 mediaProvider
1240 </a>
1241 </li>
1242
1243
1244
1245
1246
1247
1248
1249 <li class="md-nav__item">
1250 <a href="../../../../package/pip/menu/" class="md-nav__link">
1251 menu
1252 </a>
1253 </li>
1254
1255
1256
1257
1258
1259
1260
1261 <li class="md-nav__item">
1262 <a href="../../../../package/pip/menu-item/" class="md-nav__link">
1263 menuItem
1264 </a>
1265 </li>
1266
1267
1268
1269
1270
1271
1272
1273 <li class="md-nav__item">
1274 <a href="../../../../package/pip/object-type/" class="md-nav__link">
1275 objectType
1276 </a>
1277 </li>
1278
1279
1280
1281
1282
1283
1284
1285 <li class="md-nav__item">
1286 <a href="../../../../package/pip/object-type-definition/" class="md-nav__link">
1287 objectTypeDefinition
1288 </a>
1289 </li>
1290
1291
1292
1293
1294
1295
1296
1297 <li class="md-nav__item">
1298 <a href="../../../../package/pip/option/" class="md-nav__link">
1299 option
1300 </a>
1301 </li>
1302
1303
1304
1305
1306
1307
1308
1309 <li class="md-nav__item">
1310 <a href="../../../../package/pip/page/" class="md-nav__link">
1311 page
1312 </a>
1313 </li>
1314
1315
1316
1317
1318
1319
1320
1321 <li class="md-nav__item">
1322 <a href="../../../../package/pip/pip/" class="md-nav__link">
1323 pip
1324 </a>
1325 </li>
1326
1327
1328
1329
1330
1331
1332
1333 <li class="md-nav__item">
1334 <a href="../../../../package/pip/script/" class="md-nav__link">
1335 script
1336 </a>
1337 </li>
1338
1339
1340
1341
1342
1343
1344
1345 <li class="md-nav__item">
1346 <a href="../../../../package/pip/smiley/" class="md-nav__link">
1347 smiley
1348 </a>
1349 </li>
1350
1351
1352
1353
1354
1355
1356
1357 <li class="md-nav__item">
1358 <a href="../../../../package/pip/sql/" class="md-nav__link">
1359 sql
1360 </a>
1361 </li>
1362
1363
1364
1365
1366
1367
1368
1369 <li class="md-nav__item">
1370 <a href="../../../../package/pip/style/" class="md-nav__link">
1371 style
1372 </a>
1373 </li>
1374
1375
1376
1377
1378
1379
1380
1381 <li class="md-nav__item">
1382 <a href="../../../../package/pip/template/" class="md-nav__link">
1383 template
1384 </a>
1385 </li>
1386
1387
1388
1389
1390
1391
1392
1393 <li class="md-nav__item">
1394 <a href="../../../../package/pip/template-listener/" class="md-nav__link">
1395 templateListener
1396 </a>
1397 </li>
1398
1399
1400
1401
1402
1403
1404
1405 <li class="md-nav__item">
1406 <a href="../../../../package/pip/user-group-option/" class="md-nav__link">
1407 userGroupOption
1408 </a>
1409 </li>
1410
1411
1412
1413
1414
1415
1416
1417 <li class="md-nav__item">
1418 <a href="../../../../package/pip/user-menu/" class="md-nav__link">
1419 userMenu
1420 </a>
1421 </li>
1422
1423
1424
1425
1426
1427
1428
1429 <li class="md-nav__item">
1430 <a href="../../../../package/pip/user-notification-event/" class="md-nav__link">
1431 userNotificationEvent
1432 </a>
1433 </li>
1434
1435
1436
1437
1438
1439
1440
1441 <li class="md-nav__item">
1442 <a href="../../../../package/pip/user-option/" class="md-nav__link">
1443 userOption
1444 </a>
1445 </li>
1446
1447
1448
1449
1450
1451
1452
1453 <li class="md-nav__item">
1454 <a href="../../../../package/pip/user-profile-menu/" class="md-nav__link">
1455 userProfileMenu
1456 </a>
1457 </li>
1458
1459
1460
1461 </ul>
1462 </nav>
1463 </li>
1464
1465
1466
1467
1468
1469
1470
1471 <li class="md-nav__item">
1472 <a href="../../../../package/database-php-api/" class="md-nav__link">
1473 Database PHP API
1474 </a>
1475 </li>
1476
1477
1478
1479 </ul>
1480 </nav>
1481 </li>
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493 <li class="md-nav__item md-nav__item--nested">
1494
1495
1496 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_6" type="checkbox" id="__nav_6" >
1497
1498 <label class="md-nav__link" for="__nav_6">
1499 Migration
1500 <span class="md-nav__icon md-icon"></span>
1501 </label>
1502 <nav class="md-nav" aria-label="Migration" data-md-level="1">
1503 <label class="md-nav__title" for="__nav_6">
1504 <span class="md-nav__icon md-icon"></span>
1505 Migration
1506 </label>
1507 <ul class="md-nav__list" data-md-scrollfix>
1508
1509
1510
1511
1512
1513
1514 <li class="md-nav__item md-nav__item--nested">
1515
1516
1517 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_6_1" type="checkbox" id="__nav_6_1" >
1518
1519 <label class="md-nav__link" for="__nav_6_1">
1520 Migrating from WSC 5.3
1521 <span class="md-nav__icon md-icon"></span>
1522 </label>
1523 <nav class="md-nav" aria-label="Migrating from WSC 5.3" data-md-level="2">
1524 <label class="md-nav__title" for="__nav_6_1">
1525 <span class="md-nav__icon md-icon"></span>
1526 Migrating from WSC 5.3
1527 </label>
1528 <ul class="md-nav__list" data-md-scrollfix>
1529
1530
1531
1532
1533
1534 <li class="md-nav__item">
1535 <a href="../../../../migration/wsc53/php/" class="md-nav__link">
1536 PHP API
1537 </a>
1538 </li>
1539
1540
1541
1542
1543
1544
1545
1546 <li class="md-nav__item">
1547 <a href="../../../../migration/wsc53/session/" class="md-nav__link">
1548 Session Handling and Authentication
1549 </a>
1550 </li>
1551
1552
1553
1554
1555
1556
1557
1558 <li class="md-nav__item">
1559 <a href="../../../../migration/wsc53/javascript/" class="md-nav__link">
1560 TypeScript and JavaScript
1561 </a>
1562 </li>
1563
1564
1565
1566
1567
1568
1569
1570 <li class="md-nav__item">
1571 <a href="../../../../migration/wsc53/templates/" class="md-nav__link">
1572 Templates
1573 </a>
1574 </li>
1575
1576
1577
1578
1579
1580
1581
1582 <li class="md-nav__item">
1583 <a href="../../../../migration/wsc53/libraries/" class="md-nav__link">
1584 Third Party Libraries
1585 </a>
1586 </li>
1587
1588
1589
1590 </ul>
1591 </nav>
1592 </li>
1593
1594
1595
1596
1597
1598
1599
1600
1601 <li class="md-nav__item md-nav__item--nested">
1602
1603
1604 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_6_2" type="checkbox" id="__nav_6_2" >
1605
1606 <label class="md-nav__link" for="__nav_6_2">
1607 Migrating from WSC 5.2
1608 <span class="md-nav__icon md-icon"></span>
1609 </label>
1610 <nav class="md-nav" aria-label="Migrating from WSC 5.2" data-md-level="2">
1611 <label class="md-nav__title" for="__nav_6_2">
1612 <span class="md-nav__icon md-icon"></span>
1613 Migrating from WSC 5.2
1614 </label>
1615 <ul class="md-nav__list" data-md-scrollfix>
1616
1617
1618
1619
1620
1621 <li class="md-nav__item">
1622 <a href="../../../../migration/wsc52/php/" class="md-nav__link">
1623 PHP API
1624 </a>
1625 </li>
1626
1627
1628
1629
1630
1631
1632
1633 <li class="md-nav__item">
1634 <a href="../../../../migration/wsc52/templates/" class="md-nav__link">
1635 Templates and Languages
1636 </a>
1637 </li>
1638
1639
1640
1641
1642
1643
1644
1645 <li class="md-nav__item">
1646 <a href="../../../../migration/wsc52/libraries/" class="md-nav__link">
1647 Third Party Libraries
1648 </a>
1649 </li>
1650
1651
1652
1653 </ul>
1654 </nav>
1655 </li>
1656
1657
1658
1659
1660
1661
1662
1663
1664 <li class="md-nav__item md-nav__item--nested">
1665
1666
1667 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_6_3" type="checkbox" id="__nav_6_3" >
1668
1669 <label class="md-nav__link" for="__nav_6_3">
1670 Migrating from WSC 3.1
1671 <span class="md-nav__icon md-icon"></span>
1672 </label>
1673 <nav class="md-nav" aria-label="Migrating from WSC 3.1" data-md-level="2">
1674 <label class="md-nav__title" for="__nav_6_3">
1675 <span class="md-nav__icon md-icon"></span>
1676 Migrating from WSC 3.1
1677 </label>
1678 <ul class="md-nav__list" data-md-scrollfix>
1679
1680
1681
1682
1683
1684 <li class="md-nav__item">
1685 <a href="../../../../migration/wsc31/php/" class="md-nav__link">
1686 PHP API
1687 </a>
1688 </li>
1689
1690
1691
1692 </ul>
1693 </nav>
1694 </li>
1695
1696
1697
1698
1699
1700
1701
1702
1703 <li class="md-nav__item md-nav__item--nested">
1704
1705
1706 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_6_4" type="checkbox" id="__nav_6_4" >
1707
1708 <label class="md-nav__link" for="__nav_6_4">
1709 Migrating from WSC 3.0
1710 <span class="md-nav__icon md-icon"></span>
1711 </label>
1712 <nav class="md-nav" aria-label="Migrating from WSC 3.0" data-md-level="2">
1713 <label class="md-nav__title" for="__nav_6_4">
1714 <span class="md-nav__icon md-icon"></span>
1715 Migrating from WSC 3.0
1716 </label>
1717 <ul class="md-nav__list" data-md-scrollfix>
1718
1719
1720
1721
1722
1723 <li class="md-nav__item">
1724 <a href="../../../../migration/wsc30/php/" class="md-nav__link">
1725 PHP API
1726 </a>
1727 </li>
1728
1729
1730
1731
1732
1733
1734
1735 <li class="md-nav__item">
1736 <a href="../../../../migration/wsc30/javascript/" class="md-nav__link">
1737 JavaScript API
1738 </a>
1739 </li>
1740
1741
1742
1743
1744
1745
1746
1747 <li class="md-nav__item">
1748 <a href="../../../../migration/wsc30/templates/" class="md-nav__link">
1749 Templates
1750 </a>
1751 </li>
1752
1753
1754
1755
1756
1757
1758
1759 <li class="md-nav__item">
1760 <a href="../../../../migration/wsc30/css/" class="md-nav__link">
1761 CSS
1762 </a>
1763 </li>
1764
1765
1766
1767
1768
1769
1770
1771 <li class="md-nav__item">
1772 <a href="../../../../migration/wsc30/package/" class="md-nav__link">
1773 Package Components
1774 </a>
1775 </li>
1776
1777
1778
1779 </ul>
1780 </nav>
1781 </li>
1782
1783
1784
1785
1786
1787
1788
1789
1790 <li class="md-nav__item md-nav__item--nested">
1791
1792
1793 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_6_5" type="checkbox" id="__nav_6_5" >
1794
1795 <label class="md-nav__link" for="__nav_6_5">
1796 Migrating from WCF 2.1
1797 <span class="md-nav__icon md-icon"></span>
1798 </label>
1799 <nav class="md-nav" aria-label="Migrating from WCF 2.1" data-md-level="2">
1800 <label class="md-nav__title" for="__nav_6_5">
1801 <span class="md-nav__icon md-icon"></span>
1802 Migrating from WCF 2.1
1803 </label>
1804 <ul class="md-nav__list" data-md-scrollfix>
1805
1806
1807
1808
1809
1810 <li class="md-nav__item">
1811 <a href="../../../../migration/wcf21/php/" class="md-nav__link">
1812 PHP API
1813 </a>
1814 </li>
1815
1816
1817
1818
1819
1820
1821
1822 <li class="md-nav__item">
1823 <a href="../../../../migration/wcf21/templates/" class="md-nav__link">
1824 Templates
1825 </a>
1826 </li>
1827
1828
1829
1830
1831
1832
1833
1834 <li class="md-nav__item">
1835 <a href="../../../../migration/wcf21/css/" class="md-nav__link">
1836 CSS
1837 </a>
1838 </li>
1839
1840
1841
1842
1843
1844
1845
1846 <li class="md-nav__item">
1847 <a href="../../../../migration/wcf21/package/" class="md-nav__link">
1848 Package Components
1849 </a>
1850 </li>
1851
1852
1853
1854 </ul>
1855 </nav>
1856 </li>
1857
1858
1859
1860 </ul>
1861 </nav>
1862 </li>
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874 <li class="md-nav__item md-nav__item--nested">
1875
1876
1877 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_7" type="checkbox" id="__nav_7" >
1878
1879 <label class="md-nav__link" for="__nav_7">
1880 Tutorials
1881 <span class="md-nav__icon md-icon"></span>
1882 </label>
1883 <nav class="md-nav" aria-label="Tutorials" data-md-level="1">
1884 <label class="md-nav__title" for="__nav_7">
1885 <span class="md-nav__icon md-icon"></span>
1886 Tutorials
1887 </label>
1888 <ul class="md-nav__list" data-md-scrollfix>
1889
1890
1891
1892
1893
1894
1895 <li class="md-nav__item md-nav__item--nested">
1896
1897
1898 <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_7_1" type="checkbox" id="__nav_7_1" >
1899
1900 <label class="md-nav__link" for="__nav_7_1">
1901 Tutorial Series
1902 <span class="md-nav__icon md-icon"></span>
1903 </label>
1904 <nav class="md-nav" aria-label="Tutorial Series" data-md-level="2">
1905 <label class="md-nav__title" for="__nav_7_1">
1906 <span class="md-nav__icon md-icon"></span>
1907 Tutorial Series
1908 </label>
1909 <ul class="md-nav__list" data-md-scrollfix>
1910
1911
1912
1913
1914
1915 <li class="md-nav__item">
1916 <a href="../../../../tutorial/series/overview/" class="md-nav__link">
1917 Overview
1918 </a>
1919 </li>
1920
1921
1922
1923
1924
1925
1926
1927 <li class="md-nav__item">
1928 <a href="../../../../tutorial/series/part_1/" class="md-nav__link">
1929 Part 1
1930 </a>
1931 </li>
1932
1933
1934
1935
1936
1937
1938
1939 <li class="md-nav__item">
1940 <a href="../../../../tutorial/series/part_2/" class="md-nav__link">
1941 Part 2
1942 </a>
1943 </li>
1944
1945
1946
1947
1948
1949
1950
1951 <li class="md-nav__item">
1952 <a href="../../../../tutorial/series/part_3/" class="md-nav__link">
1953 Part 3
1954 </a>
1955 </li>
1956
1957
1958
1959 </ul>
1960 </nav>
1961 </li>
1962
1963
1964
1965 </ul>
1966 </nav>
1967 </li>
1968
1969
1970
1971 </ul>
1972 </nav>
1973 </div>
1974 </div>
1975 </div>
1976
1977
1978
1979 <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
1980 <div class="md-sidebar__scrollwrap">
1981 <div class="md-sidebar__inner">
1982
1983 <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
1984
1985
1986
1987
1988
1989 <label class="md-nav__title" for="__toc">
1990 <span class="md-nav__icon md-icon"></span>
1991 Table of contents
1992 </label>
1993 <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
1994
1995 <li class="md-nav__item">
1996 <a href="#form-validation" class="md-nav__link">
1997 Form Validation
1998 </a>
1999
2000 <nav class="md-nav" aria-label="Form Validation">
2001 <ul class="md-nav__list">
2002
2003 <li class="md-nav__item">
2004 <a href="#iformfieldvalidationerror-formfieldvalidationerror" class="md-nav__link">
2005 IFormFieldValidationError / FormFieldValidationError
2006 </a>
2007
2008 </li>
2009
2010 <li class="md-nav__item">
2011 <a href="#iformfieldvalidator-formfieldvalidator" class="md-nav__link">
2012 IFormFieldValidator / FormFieldValidator
2013 </a>
2014
2015 </li>
2016
2017 </ul>
2018 </nav>
2019
2020 </li>
2021
2022 <li class="md-nav__item">
2023 <a href="#form-data" class="md-nav__link">
2024 Form Data
2025 </a>
2026
2027 <nav class="md-nav" aria-label="Form Data">
2028 <ul class="md-nav__list">
2029
2030 <li class="md-nav__item">
2031 <a href="#iformdatahandler-formdatahandler" class="md-nav__link">
2032 IFormDataHandler / FormDataHandler
2033 </a>
2034
2035 </li>
2036
2037 <li class="md-nav__item">
2038 <a href="#iformdataprocessor-defaultformdataprocessor" class="md-nav__link">
2039 IFormDataProcessor / DefaultFormDataProcessor
2040 </a>
2041
2042 </li>
2043
2044 <li class="md-nav__item">
2045 <a href="#additional-data-processors" class="md-nav__link">
2046 Additional Data Processors
2047 </a>
2048
2049 <nav class="md-nav" aria-label="Additional Data Processors">
2050 <ul class="md-nav__list">
2051
2052 <li class="md-nav__item">
2053 <a href="#customformdataprocessor" class="md-nav__link">
2054 CustomFormDataProcessor
2055 </a>
2056
2057 </li>
2058
2059 <li class="md-nav__item">
2060 <a href="#voidformdataprocessor" class="md-nav__link">
2061 VoidFormDataProcessor
2062 </a>
2063
2064 </li>
2065
2066 </ul>
2067 </nav>
2068
2069 </li>
2070
2071 </ul>
2072 </nav>
2073
2074 </li>
2075
2076 </ul>
2077
2078 </nav>
2079 </div>
2080 </div>
2081 </div>
2082
2083
2084 <div class="md-content" data-md-component="content">
2085 <article class="md-content__inner md-typeset">
2086
2087
2088 <a href="https://github.com/WoltLab/docs.woltlab.com/edit/5.4/docs/php/api/form_builder/validation_data.md" title="Edit this page" class="md-content__button md-icon">
2089 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25z"/></svg>
2090 </a>
2091
2092
2093 <h1 id="form-validation-and-form-data">Form Validation and Form Data<a class="headerlink" href="#form-validation-and-form-data" title="Permanent link">#</a></h1>
2094 <h2 id="form-validation">Form Validation<a class="headerlink" href="#form-validation" title="Permanent link">#</a></h2>
2095 <p>Every form field class has to implement <code>IFormField::validate()</code> according to their internal logic of what constitutes a valid value.
2096 If a certain constraint for the value is no met, a form field validation error object is added to the form field.
2097 Form field validation error classes have to implement the interface <code>IFormFieldValidationError</code>.</p>
2098 <p>In addition to intrinsic validations like checking the length of the value of a text form field, in many cases, there are additional constraints specific to the form like ensuring that the text is not already used by a different object of the same database object class.
2099 Such additional validations can be added to (and removed from) the form field via implementations of the <code>IFormFieldValidator</code> interface.</p>
2100 <h3 id="iformfieldvalidationerror-formfieldvalidationerror"><code>IFormFieldValidationError</code> / <code>FormFieldValidationError</code><a class="headerlink" href="#iformfieldvalidationerror-formfieldvalidationerror" title="Permanent link">#</a></h3>
2101 <p><code>IFormFieldValidationError</code> requires the following methods:</p>
2102 <ul>
2103 <li><code>__construct($type, $languageItem = null, array $information = [])</code> creates a new validation error object for an error with the given type and message stored in the given language items.
2104 The information array is used when generating the error message.</li>
2105 <li><code>getHtml()</code> returns the HTML element representing the error that is shown to the user.</li>
2106 <li><code>getMessage()</code> returns the error message based on the language item and information array given in the constructor.</li>
2107 <li><code>getInformation()</code> and <code>getType()</code> are getters for the first and third parameter of the constructor.</li>
2108 </ul>
2109 <p><code>FormFieldValidationError</code> is a default implementation of the interface that shows the error in an <code>small.innerError</code> HTML element below the form field.</p>
2110 <p>Form field validation errors are added to form fields via the <code>IFormField::addValidationError(IFormFieldValidationError $error)</code> method.</p>
2111 <h3 id="iformfieldvalidator-formfieldvalidator"><code>IFormFieldValidator</code> / <code>FormFieldValidator</code><a class="headerlink" href="#iformfieldvalidator-formfieldvalidator" title="Permanent link">#</a></h3>
2112 <p><code>IFormFieldValidator</code> requires the following methods:</p>
2113 <ul>
2114 <li><code>__construct($id, callable $validator)</code> creates a new validator with the given id that passes the validated form field to the given callable that does the actual validation.
2115 <code>static validateId($id)</code> is used to check if the given id is valid.</li>
2116 <li><code>__invoke(IFormField $field)</code> is used when the form field is validated to execute the validator.</li>
2117 <li><code>getId()</code> returns the id of the validator.</li>
2118 </ul>
2119 <p><code>FormFieldValidator</code> is a default implementation of the interface.</p>
2120 <p>Form field validators are added to form fields via the <code>addValidator(IFormFieldValidator $validator)</code> method.</p>
2121 <h2 id="form-data">Form Data<a class="headerlink" href="#form-data" title="Permanent link">#</a></h2>
2122 <p>After a form is successfully validated, the data of the form fields (returned by <code>IFormDocument::getData()</code>) have to be extracted which is the job of the <code>IFormDataHandler</code> object returned by <code>IFormDocument::getDataHandler()</code>.
2123 Form data handlers themselves, however, are only iterating through all <code>IFormDataProcessor</code> instances that have been registered with the data handler.</p>
2124 <h3 id="iformdatahandler-formdatahandler"><code>IFormDataHandler</code> / <code>FormDataHandler</code><a class="headerlink" href="#iformdatahandler-formdatahandler" title="Permanent link">#</a></h3>
2125 <p><code>IFormDataHandler</code> requires the following methods:</p>
2126 <ul>
2127 <li><code>addProcessor(IFormDataProcessor $processor)</code> adds a new data processor to the data handler.</li>
2128 <li><code>getFormData(IFormDocument $document)</code> returns the data of the given form by applying all registered data handlers on the form.</li>
2129 <li><code>getObjectData(IFormDocument $document, IStorableObject $object)</code> returns the data of the given object which will be used to populate the form field values of the given form.</li>
2130 </ul>
2131 <p><code>FormDataHandler</code> is the default implementation of this interface and should also be extended instead of implementing the interface directly.</p>
2132 <h3 id="iformdataprocessor-defaultformdataprocessor"><code>IFormDataProcessor</code> / <code>DefaultFormDataProcessor</code><a class="headerlink" href="#iformdataprocessor-defaultformdataprocessor" title="Permanent link">#</a></h3>
2133 <p><code>IFormDataProcessor</code> requires the following methods:</p>
2134 <ul>
2135 <li><code>processFormData(IFormDocument $document, array $parameters)</code> is called by <code>IFormDataHandler::getFormData()</code>.
2136 The method processes the given parameters array and returns the processed version.</li>
2137 <li><code>processObjectData(IFormDocument $document, array $data, IStorableObject $object)</code> is called by <code>IFormDataHandler::getObjectData()</code>.
2138 The method processes the given object data array and returns the processed version.</li>
2139 </ul>
2140 <p>When <code>FormDocument</code> creates its <code>FormDataHandler</code> instance, it automatically registers an <code>DefaultFormDataProcessor</code> object as the first data processor.
2141 <code>DefaultFormDataProcessor</code> puts the save value of all form fields that are available and have a save value into <code>$parameters['data']</code> using the form field’s object property as the array key.</p>
2142 <div class="admonition warning">
2143 <p class="admonition-title"><code>IFormDataProcessor</code> should not be implemented directly. Instead, <code>AbstractFormDataProcessor</code> should be extended.</p>
2144 </div>
2145 <div class="admonition info">
2146 <p class="admonition-title">All form data is put into the <code>data</code> sub-array so that the whole <code>$parameters</code> array can be passed to a database object action object that requires the actual database object data to be in the <code>data</code> sub-array.</p>
2147 </div>
2148 <h3 id="additional-data-processors">Additional Data Processors<a class="headerlink" href="#additional-data-processors" title="Permanent link">#</a></h3>
2149 <h4 id="customformdataprocessor"><code>CustomFormDataProcessor</code><a class="headerlink" href="#customformdataprocessor" title="Permanent link">#</a></h4>
2150 <p>As mentioned above, the data in the <code>data</code> sub-array is intended to directly create or update the database object with.
2151 As these values are used in the database query directly, these values cannot contain arrays.
2152 Several form fields, however, store and return their data in form of arrays.
2153 Thus, this data cannot be returned by <code>IFormField::getSaveValue()</code> so that <code>IFormField::hasSaveValue()</code> returns <code>false</code> and the form field’s data is not collected by the standard <code>DefaultFormDataProcessor</code> object.</p>
2154 <p>Instead, such form fields register a <code>CustomFormDataProcessor</code> in their <code>IFormField::populate()</code> method that inserts the form field value into the <code>$parameters</code> array directly.
2155 This way, the relevant database object action method has access to the data to save it appropriately.</p>
2156 <p>The constructor of <code>CustomFormDataProcessor</code> requires an id (that is primarily used in error messages during the validation of the second parameter) and callables for <code>IFormDataProcessor::processFormData()</code> and <code>IFormDataProcessor::processObjectData()</code> which are passed the same parameters as the <code>IFormDataProcessor</code> methods.
2157 Only one of the callables has to be given, the other one then defaults to simply returning the relevant array unchanged.</p>
2158 <h4 id="voidformdataprocessor"><code>VoidFormDataProcessor</code><a class="headerlink" href="#voidformdataprocessor" title="Permanent link">#</a></h4>
2159 <p>Some form fields might only exist to toggle the visibility of other form fields (via dependencies) but the data of form field itself is irrelevant.
2160 As <code>DefaultFormDataProcessor</code> collects the data of all form fields, an additional data processor in the form of a <code>VoidFormDataProcessor</code> can be added whose constructor <code>__construct($property, $isDataProperty = true)</code> requires the name of the relevant object property/form id and whether the form field value is stored in the <code>data</code> sub-array or directory in the <code>$parameters</code> array.
2161 When the data processor is invoked, it checks whether the relevant entry in the <code>$parameters</code> array exists and voids it by removing it from the array.</p>
2162
2163
2164
2165
2166 <hr>
2167 <div class="md-source-date">
2168 <small>
2169
2170 Last update: 2021-01-15
2171
2172 </small>
2173 </div>
2174
2175
2176
2177
2178
2179
2180
2181
2182 </article>
2183 </div>
2184 </div>
2185
2186 </main>
2187
2188
2189 <footer class="md-footer">
2190
2191 <nav class="md-footer__inner md-grid" aria-label="Footer">
2192
2193 <a href="../form_fields/" class="md-footer__link md-footer__link--prev" rel="prev">
2194 <div class="md-footer__button md-icon">
2195 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
2196 </div>
2197 <div class="md-footer__title">
2198 <div class="md-ellipsis">
2199 <span class="md-footer__direction">
2200 Previous
2201 </span>
2202 Fields
2203 </div>
2204 </div>
2205 </a>
2206
2207
2208 <a href="../dependencies/" class="md-footer__link md-footer__link--next" rel="next">
2209 <div class="md-footer__title">
2210 <div class="md-ellipsis">
2211 <span class="md-footer__direction">
2212 Next
2213 </span>
2214 Dependencies
2215 </div>
2216 </div>
2217 <div class="md-footer__button md-icon">
2218 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4z"/></svg>
2219 </div>
2220 </a>
2221
2222 </nav>
2223
2224 <div class="md-footer-meta md-typeset">
2225 <div class="md-footer-meta__inner md-grid">
2226 <div class="md-footer-copyright">
2227
2228 <div class="md-footer-copyright__highlight">
2229 Copyright © 2020 WoltLab GmbH
2230 </div>
2231
2232 Made with
2233 <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
2234 Material for MkDocs
2235 </a>
2236
2237 </div>
2238 <div class="md-footer-copyright">
2239 <a href="https://www.woltlab.com/legal-notice/">Legal Notice</a>
2240 <a href="https://www.woltlab.com/privacy-policy/">Privacy Policy</a>
2241 </div>
2242 </div>
2243 </div>
2244 </footer>
2245
2246 </div>
2247 <div class="md-dialog" data-md-component="dialog">
2248 <div class="md-dialog__inner md-typeset"></div>
2249 </div>
2250 <script id="__config" type="application/json">{"base": "../../../..", "features": [], "translations": {"clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.placeholder": "Type to start searching", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.term.missing": "Missing"}, "search": "../../../../assets/javascripts/workers/search.fe42c31b.min.js", "version": {"provider": "mike"}}</script>
2251
2252
2253 <script src="../../../../assets/javascripts/bundle.d892486b.min.js"></script>
2254
2255
2256 </body>
2257 </html>