Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Error messages without closing a modal #4513

Unanswered
Discussion options

It would be nice to have a response type to allow showing an error message inside the modal if some of the fields aren't right, rather than having the modal close and requiring the user to re-enter their text

image

basically, let us show a message like that but with our own error message text

otherwise, bots have to implement holding modal state themselves so when users reopen the modal it keeps the text they had entered. which works but it's a bit clumsy

You must be logged in to vote

Replies: 2 comments 4 replies

Comment options

I'd love this as well as just normal form validation like Bootstrap:
image

Like if we need an email, or something, let the bot validate it and return errors for the user to solve (this is in addition to your suggestion)

You must be logged in to vote
4 replies
Comment options

The following things they should add:

  • User
  • Role
  • Channel
  • Multiple Choice
  • Choices (Here you can only select 1 out of the given choices. Like: Yes, No

And this

Like if we need an email, or something, let the bot validate it and return errors for the user to solve (this is in addition to your suggestion)

will never be. Because Discord cares about its users' safety, their personal information should be kept secret.
They will not make it so you can ask people for their email or stuff.

Comment options

All of those are separate suggestions, and that was an example, validations can apply to anything, not just emails; and besides, we do have a use case where we need an email, so it's not far-fetched.

Comment options

But then it should only be made for Verified bots.

Because else Discord would be like any other social media channel: Insert your email and get free stuff! 😂

Comment options

I disagree. Anyone can create a custom bot for their discord community, and should be able to ask for any information they need to operate and perform validation on it. Then, it's the Discord server admin's responsibility to not enable bots that try to harvest users' data.

Validation and in-modal errors would be very helpful.

Comment options

I'll bump this as I'm trying out modals and see the same 3-year-old issue.
Modal inputs' native validation is limited, and if there is a need to have a deeper validation, for example, checking if the text input contains a specific phrase, then both options to do so are bad:

  1. Send a reply to the modal interaction so it closes and the user sees the message. However, the modal fields are now reset.
  2. Send a follow-up to the original interaction ONCE so the modal fields persist. However, now the modal doesn't close, and the user doesn't see the message without manually closing the modal.

We can use better label descriptions and store failed modal values in cache so they can be set as defaults on the next try; however, this is rather awkward for both the user and the developer.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /