How to make input required before action component in canvas-kit

  • 5 November 2023
  • 2 replies

I am building a custom app in messenger home. It will open a form asking user input and submit. I wonder if there is any built-in method to make interaction component required (input, text area, select etc) before the user hit action component (button).

Also, my app will stay at the submit flow after the user interaction. Is anyway I can reset the UI back to initialize flow?


Best answer by Jacob Cox 13 November 2023, 00:06

View original

2 replies

Userlevel 4
Badge +5

Hi @Mizuha !

If you want to make sure a user includes a value in an input field, you could add note in the text letting them know that it’s required and render the button disabled unless they’ve included text there. You could also wait for them to submit the form and verify that the fields have values on the backend. If they don’t you can return a canvas that asks them to retry with all of the fields filled.

Our Canvas Kit docs discuss the circular flow of information from intializing, to submit, to (possibly) a sheet, back to initialization. I would recommend reading over our docs on the subject here.

Hi @Jacob Cox 

Thank you for help. The last step of my app submit flow will render a button (URL action) to redirect the user to a url. This action will not trigger the submit flow anymore. In this case, how do I return the user back to the initialize flow?