Exercise

Conditionally show or hide required inputs

The word cloud app now has three different ways to supply words to the word cloud. Two of these methods involve a specific UI element that is only useful for them: there is a textarea that is only used when the user selects the "own" word source, and there is a file input that is only relevant when the user chooses the "file" source. Ideally, only inputs that are needed would appear at any given moment.

Instructions

100 XP

The textarea has already been wrapped in a conditionalPanel() so that it will only appear when the user chooses to input their own text. Your task is to conditionally show the file input only when the user selects the file upload as the data source. Specifically:

  • Wrap the file input in a conditional panel (line 19).
  • The condition for the panel needs to be met when the user chooses the "file" option from the data source radio buttons (line 22).