question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Returning error after a view submit

See original GitHub issue

Description

Hi all šŸ‘‹, Here’s the flow of my app:

  1. The user mention the bot in any channel.
  2. The app replies with a welcome message and options (including ā€œCreateā€ a new item)
  3. If the user clicks ā€˜create’, the app opens a modal with a form.
  4. If there’s no error, the app replaces the message from .2 with a feedback/overview about the item created.

I’m struggling to validate the form.

First, I’m not 100% what’s the proper method to listen for submit: app.action with callback_id or app.view?

If I use app.action it says ā€œAn incoming event was not acknowledged before the timeout. Ensure that the ack() argument is called in your listenersā€ in the console and ā€œWe had some trouble connecting. Try again?ā€ in the modal’s header.

app.action({ callback_id: 'create' }, ({ ack }) => ack({ errors }))

If I use app.view, the callback is fired but I can only reply with ack(), with no error:

app.view('create', ({ ack }) => ack({ errors }));

Once the user submit the view, using the previous listener, the modal shows: ā€œWe had some trouble connecting. Try again?ā€ but faster, before the 3 seconds limit. I’m assuming the ack sent the response.

On top of all that: I have two rules to validate the form, that could be ā€œonBlur/onChangeā€: a) there a input/plain text that must to be unique (need to check the database) b) there a multi_user_select that must to have 2+ items.

I know that radio button supports this kind of ā€˜onChange’ validations. Input and selects also supports it?

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • I’ve read and understood the Contributing guidelines and have done my best effort to follow them.
  • I’ve read and agree to the Code of Conduct.
  • I’ve searched for any related issues and avoided creating a duplicate issue.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
Falcicommented, Feb 7, 2020

Sorry by my delay. It worked.

ack({
  response_action: 'errors',
  errors: {
    field: 'error'
  }
});
0reactions
seratchcommented, Feb 7, 2020

@Falci Please let me know if you have something further to ask or discuss here. Otherwise, allow me to close this issue.

I empathize with your inconvenience with block_actions. However, the Bolt team doesn’t have any actions to take until the Slack Platform introduces new features related to this. šŸ™

Read more comments on GitHub >

github_iconTop Results From Across the Web

MVC 4 - Return error message from Controller - Show in View
The Return View(model) returns you error because you don't fill the model with the values in your post method and the model data...
Read more >
How to display error message in forms when submitted? - MSDN
What I want is that after clicking the Submit button, the page will not refresh until there's a required field to fill in....
Read more >
Returning to form after error occurs during form submit process
I have a custom multi-step form that had an error during the database save process of the form submit. The error was rolled...
Read more >
Handling Application Errors — Flask Documentation (2.2.x)
An error handler is a function that returns a response when a type of error is raised, similar to how a view is...
Read more >
Error Messages | Maps JavaScript API - Google Developers
Under certain circumstances, a darkened map, or 'negative' Street View image, ... The following tables list the possible error codes returned by the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found