Answer based text

Hi there,
Not really an expert, I´m only trying to create a simple question game.
So, I have a user input text answer box and, based on the answer that is introduced I want a specific text to appear. For example, I have the question “Choose a fruit: banana, strawberry or orange”. If they write banana I want “Good choice!” to appear. If they write strawberry I want “My favourite too!” to appear, and so on…

I hope I could explain myself, but thanks for all the help.

Hi,

Welcome to the Corvid Forum.

You can use a Dropdown 's onChange Function to show and hide your elements using their Element ID

A code such as below can be useful

export function dropdown1_change(event) {
     if($w("#dropdown1").value === 'banana') {
         $w("#bananaElement").show();
         $w("#favoriteText").hide();
     } else if($w("#dropdown1").value === 'strawberry') {
         $w("#favoriteText").show();
         $w("#bananaElement").hide();
     }
}

Or you can inject the text in the same text input element like this

export function dropdown1_change(event) {
     if($w("#dropdown1").value === 'banana') {
         $w("#textElement").text = 'Good Choice!';
     } else if($w("#dropdown1").value === 'strawberry') {
         $w("#textElement").text = 'My favorite too!';
     }
}

Thank you for the answer. But what is the banana element?