File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed
packages/feedback/src/widget Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -88,21 +88,21 @@ export function createWidget({
88
88
return ;
89
89
}
90
90
91
- // Simple validation for now, just check for non-empty message
92
- if ( ! feedback . message ) {
93
- dialog . showError ( 'Please enter in some feedback before submitting!' ) ;
94
- return ;
95
- }
96
-
97
- // Simple validation for now, just check for non-empty message if name required
91
+ // Simple validation for now, just check for non-empty required fields
92
+ const emptyField = [ ] ;
98
93
if ( options . isNameRequired && ! feedback . name ) {
99
- dialog . showError ( 'Please enter in a name before submitting!' ) ;
94
+ emptyField . push ( options . nameLabel ) ;
100
95
return ;
101
96
}
102
-
103
- // Simple validation for now, just check for non-empty message if email required
104
97
if ( options . isEmailRequired && ! feedback . email ) {
105
- dialog . showError ( 'Please enter in an email before submitting!' ) ;
98
+ emptyField . push ( options . emailLabel ) ;
99
+ return ;
100
+ }
101
+ if ( ! feedback . message ) {
102
+ emptyField . push ( options . messageLabel ) ;
103
+ }
104
+ if ( ! emptyField . length ) {
105
+ dialog . showError ( `Please enter in the following required fields: ${ emptyField . join ( ', ' ) } ` ) ;
106
106
return ;
107
107
}
108
108
You can’t perform that action at this time.
0 commit comments