You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hello! I recently made this form thing for recommendations; however, it's not working whenever I click it. Nothing outputs and nothing works.
⌨️ Code
Function for submission:
constonSubmit: SubmitHandler<FormSchema>=async(data,event)=>{console.log('Button has been clicked!')event?.preventDefault();try{constresponse=awaitaxios.post("/api/discord-webhook",data);toast({title: "Success!",description: response.data.message||"Recommendation sent!"});}catch(err){console.error("Failed to send recommendation: ",err);toast({title: "Failed.",description: "Failed to send recommendation."});}};
Form itself:
<Form{... form}><formonSubmit={form.handleSubmit(onSubmit)}><FormFieldcontrol={form.control}name="recommendation"render={({ field })=>(<FormItem><FormLabel>Recommendation</FormLabel><FormControl><Inputplaceholder="Suggestion here..."{...field}/></FormControl><FormDescription>Thisisyoursuggestion/recommendationtothewebsite!</FormDescription><FormMessage/></FormItem>)}/><Buttontype="submit">Submit</Button>{/*ThisisthebuttonI'm talking about */}</form></Form>
If you have any idea why this is happening, please let me know!
* edit: I added an onclick event to the button, that works; however, the submitting doesnt.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
hello! I recently made this form thing for recommendations; however, it's not working whenever I click it. Nothing outputs and nothing works.
⌨️ Code
Function for submission:Form itself:
Beta Was this translation helpful? Give feedback.
All reactions