Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How will prevent empty message or spaces click #196

Open
arunachalamv-cyberinnov opened this issue Aug 20, 2024 · 2 comments
Open

How will prevent empty message or spaces click #196

arunachalamv-cyberinnov opened this issue Aug 20, 2024 · 2 comments

Comments

@arunachalamv-cyberinnov

image

@devo-id
Copy link

devo-id commented Sep 15, 2024

I figured out that the Chatbot component provides a validator function. Chatbot properties
That function allows you to specify what needs to be considered as a message.

So for your case, it will be like-

const validateInput = (input) =>{
 return input.length > 0 && input.trim().length !=0;
}

<Chatbot
 //other configurations 
  validator={validateInput}
/> 

It will prevent the message from being sent.

@rajateshk
Copy link

Worked

I figured out that the Chatbot component provides a validator function. Chatbot properties That function allows you to specify what needs to be considered as a message.

So for your case, it will be like-

const validateInput = (input) =>{
 return input.length > 0 && input.trim().length !=0;
}

<Chatbot
 //other configurations 
  validator={validateInput}
/> 

It will prevent the message from being sent.

Thanks @devo-id to pointing that out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants