How can I set form submit button to disabled until form is empty using useActionState hook?
I have a form in a React app. I am using the useActionState
hook to manage form status. How can I set the submit button to disabled until the user enters something in the text input?
Submit Button Is Navigating Away From the Page
I’m currently building a website using Next.js (React) and Strapi, and I’ve encountered an issue while setting up the newsletter subscription form.
Javascript form.submit() doesn’t trigger form submission while onSubmit event
const apiRedirectUrl = redirectUrl + '&sessionToken=' + response.sessionToken; const form = document.createElement('form'); form.method = 'POST'; form.action = apiRedirectUrl; document.body.appendChild(form); console.log('calling submit');form.submit(); document.body.removeChild(form);