1

I have a slack input element that I want to clear after user has submitted it. Is that possible?

the block:

{
    dispatch_action: true,
    type: "input",
    element: {
      type: "plain_text_input",
      action_id: "some-action-id",
    },
    label: {
      type: "plain_text",
      text: "Some label here",
      emoji: true,
    },
  }
Shining Love Star
  • 5,734
  • 5
  • 39
  • 49

1 Answers1

0

It is possible but, depending on your use case, it might not be what you want.

Unfortunately, there is no easy API call you can make to clear existing fields in the traditional sense. Instead, what you would have to do is send a brand new view back to the modal in question.

If you don't have a modal and this is just a form being posted as a message somewhere, then the same concept applies except you would edit the message blocks using https://api.slack.com/methods/chat.update and send a fresh set of blocks that looks exactly how your form looked.

You should be aware that this may overwrite the contents of users who were inputting data into those fields. For example, if you posted the form in a public space and multiple users are filling it out, then you may not want to send a fresh set of blocks to update/edit that message every time someone fills out the form.

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
JTega
  • 23
  • 5