File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -281,6 +281,15 @@ export interface FormOptions<
281281 TOnSubmit ,
282282 TOnSubmitAsync
283283 >
284+ /**
285+ * Specifies which validation type to use on the first submission attempt
286+ */
287+ validationOnFirstAttempt ?: ValidationCause ;
288+
289+ /**
290+ * Specifies which validation type to use on subsequent submission attempts
291+ */
292+ validationOnConsequentAttempts ?: ValidationCause ;
284293 /**
285294 * A function to be called when the form is submitted, what should happen once the user submits a valid form returns `any` or a promise `Promise<any>`
286295 */
@@ -1500,7 +1509,12 @@ export class FormApi<
15001509 this . baseStore . setState ( ( prev ) => ( { ...prev , isSubmitting : false } ) )
15011510 }
15021511
1503- await this . validateAllFields ( 'submit' )
1512+ //
1513+ const validationType = this . state . submissionAttempts === 0
1514+ ? this . options . validationOnFirstAttempt ?? 'submit'
1515+ : this . options . validationOnConsequentAttempts ?? 'submit' ;
1516+
1517+ await this . validateAllFields ( validationType )
15041518
15051519 if ( ! this . state . isFieldsValid ) {
15061520 done ( )
@@ -1511,7 +1525,7 @@ export class FormApi<
15111525 return
15121526 }
15131527
1514- await this . validate ( 'submit' )
1528+ await this . validate ( validationType )
15151529
15161530 // Fields are invalid, do not submit
15171531 if ( ! this . state . isValid ) {
You can’t perform that action at this time.
0 commit comments