This repository was archived by the owner on Jun 26, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,6 +80,10 @@ export function BackupCreatePage() {
8080 return
8181 }
8282
83+ // Run RJSF validation before the page-level checks so schema-required
84+ // fields render inline errors instead of being masked by the alerts below.
85+ if ( schemaFormRef . current && ! schemaFormRef . current . validate ( ) ) return
86+
8387 if ( ! formData . applicationRef ?. kind || ! formData . applicationRef ?. name ) {
8488 alert ( "Application reference is required" )
8589 return
@@ -95,10 +99,6 @@ export function BackupCreatePage() {
9599 return
96100 }
97101
98- // The submit button lives outside RJSF and bypasses its validation, so
99- // trigger it explicitly; an invalid spec renders errors inline and aborts.
100- if ( schemaFormRef . current && ! schemaFormRef . current . validate ( ) ) return
101-
102102 const resource = {
103103 apiVersion : "backups.cozystack.io/v1alpha1" ,
104104 kind : "Backup" ,
Original file line number Diff line number Diff line change @@ -120,6 +120,10 @@ export function BackupJobCreatePage() {
120120 return
121121 }
122122
123+ // Run RJSF validation before the page-level checks so schema-required
124+ // fields render inline errors instead of being masked by the alerts below.
125+ if ( schemaFormRef . current && ! schemaFormRef . current . validate ( ) ) return
126+
123127 if ( ! formData . applicationRef ?. kind || ! formData . applicationRef ?. name ) {
124128 alert ( "Application reference is required" )
125129 return
@@ -130,10 +134,6 @@ export function BackupJobCreatePage() {
130134 return
131135 }
132136
133- // The submit button lives outside RJSF and bypasses its validation, so
134- // trigger it explicitly; an invalid spec renders errors inline and aborts.
135- if ( schemaFormRef . current && ! schemaFormRef . current . validate ( ) ) return
136-
137137 // planRef is optional metadata recording which Plan triggered the job. The
138138 // dropdown ships an empty sentinel; strip it so the API never receives
139139 // `planRef: { name: "" }`, which would otherwise round-trip as a malformed
Original file line number Diff line number Diff line change @@ -114,6 +114,10 @@ export function BackupPlanCreatePage() {
114114 return
115115 }
116116
117+ // Run RJSF validation before the page-level checks so schema-required
118+ // fields render inline errors instead of being masked by the alerts below.
119+ if ( schemaFormRef . current && ! schemaFormRef . current . validate ( ) ) return
120+
117121 if ( ! formData . applicationRef ?. kind || ! formData . applicationRef ?. name ) {
118122 alert ( "Application reference is required" )
119123 return
@@ -124,10 +128,6 @@ export function BackupPlanCreatePage() {
124128 return
125129 }
126130
127- // The submit button lives outside RJSF and bypasses its validation, so
128- // trigger it explicitly; an invalid spec renders errors inline and aborts.
129- if ( schemaFormRef . current && ! schemaFormRef . current . validate ( ) ) return
130-
131131 const resource = {
132132 apiVersion : "backups.cozystack.io/v1alpha1" ,
133133 kind : "Plan" ,
Original file line number Diff line number Diff line change @@ -133,6 +133,10 @@ export function BackupRestoreJobCreatePage() {
133133 return
134134 }
135135
136+ // Run RJSF validation before the page-level checks so schema-required
137+ // fields render inline errors instead of being masked by the alerts below.
138+ if ( schemaFormRef . current && ! schemaFormRef . current . validate ( ) ) return
139+
136140 if ( ! formData . backupRef ?. name ) {
137141 alert ( "Backup reference is required" )
138142 return
@@ -149,10 +153,6 @@ export function BackupRestoreJobCreatePage() {
149153 return
150154 }
151155
152- // The submit button lives outside RJSF and bypasses its validation, so
153- // trigger it explicitly; an invalid spec renders errors inline and aborts.
154- if ( schemaFormRef . current && ! schemaFormRef . current . validate ( ) ) return
155-
156156 // Strip an empty targetApplicationRef so the API does not receive an empty
157157 // object that the API server would reject as malformed.
158158 const spec = { ...formData }
You can’t perform that action at this time.
0 commit comments