-1

I am using ReactJS and created a form. I want to disable the send button if the text area in the form has spelling errors.

Spell check that I tried just underlines the spelling errors but it does not send any event or set any property or attribute. Because of this, I can't figure out that there is spelling error.

Is this even possible for my ReactJS code to get notified of spelling errors?

2
  • You could use a JavaScript spellchecker library like typo-js: npmjs.com/package/typo-js Commented Jun 14, 2024 at 7:57
  • @AlessandroSantamaria Thanks!! can it check the complete sentence ? or in loop i need to check one by one? and this can be used in frontend
    – Code Guru
    Commented Jun 14, 2024 at 10:48

1 Answer 1

0

Well, your question is a little confusing. After all, libraries that check for errors are based on dictionaries, and what they may consider an error might not be an error for the user. So, disabling the button is not really a good pattern because you have to consider things like jokes, language, and slang. What I highly recommend now is to use an API for an LLM model like ChatGPT or Gemini to verify if a sentence is grammatically and vocabulary correct since it can understand the whole context of the sentence.

gemini: https://ai.google.dev/ chatgpt: https://platform.openai.com/docs/overview

you can visit https://www.tensorflow.org/js to check tensorflow browser model that you can load in your web app to directly verify the sentence without using an api there are a lot MlM doing that today

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.