@@ -65,8 +65,9 @@ export class ReviewForm extends LitElement {
6565 return html `<for m
6666 id= "review-form"
6767 action = "${ this . baseHost } ${ this . endpointPath } "
68+ method = "post"
6869 >
69- ${ this . errors
70+ ${ this . errors . length
7071 ? html `<div class= "errors" > ${ this . errors . join ( ' ' ) } </ div> `
7172 : nothing }
7273 ${ this . starsInputTemplate } ${ this . subjectInputTemplate }
@@ -135,27 +136,24 @@ export class ReviewForm extends LitElement {
135136
136137 /* Renders all the hidden inputs we use to store other information for form submission */
137138 private get hiddenInputsTemplate ( ) : HTMLTemplateResult {
138- return html `${ this . identifier
139- ? html `<input
140- type= "hidden"
141- name = "identifier"
142- .value = ${ this . identifier }
143- / > `
144- : nothing }
145- ${ this . token
146- ? html `<input
147- type= "hidden"
148- name = "field_reviewto ken"
149- .value = ${ this . token }
150- / > `
151- : nothing }
152- ${ this . recaptchaToken
153- ? html `<input
154- type= "hidden"
155- name = "g- recaptcha- response"
156- .value = ${ this . recaptchaToken }
157- / > `
158- : nothing } `;
139+ return html `<input
140+ type= "hidden"
141+ name = "field_reviewto ken"
142+ .value = ${ this . token }
143+ / >
144+ <input
145+ type= "hidden"
146+ name = "g- recaptcha- response"
147+ .value = ${ this . recaptchaToken }
148+ / >
149+ <input type= "hidden" name = "action" value= "1" / >
150+ ${ this . identifier
151+ ? html `<input
152+ type= "hidden"
153+ name = "identifier"
154+ .value = ${ this . identifier }
155+ / > `
156+ : nothing } `;
159157 }
160158
161159 private get actionButtonsTemplate ( ) : HTMLTemplateResult {
@@ -199,11 +197,13 @@ export class ReviewForm extends LitElement {
199197
200198 private async handleSubmit ( e : Event ) : Promise < void > {
201199 e . preventDefault ( ) ;
200+ if ( ! this . reviewForm . reportValidity ( ) ) return ;
202201
203202 try {
204203 const recaptchaToken = await this . recaptchaWidget ?. execute ( ) ;
205204 this . recaptchaToken = recaptchaToken ?? '' ;
206205
206+ // Wait for recaptcha token to be added to form
207207 await this . updateComplete ;
208208 this . reviewForm . requestSubmit ( ) ;
209209 } catch {
0 commit comments