Touch Develop retirement postponed until June 22, 2019. Sign-in and access to cloud assets to be removed on May 23, 2018.Learn More..


user input

The wall service provides various actions to request user input.

actions

var text := wall → ask string("what is your name?")
var x := wall → ask number("what is your age?")
var yes or no := wall → ask boolean("do you agree?", "are you sure?")
var d := wall → pick date("what is your birthday?", "pick a date")
var t := wall → pick time("when were you born?", "pick a time")

choosing a string from a list

You can use the wall→pick string action to ask the user to pick an item from a list. pick string takes a String Collection which you can easily create using string→split.
  • split a string into a collection of strings
var choices := "blue,red,green" → split(",")
  • ask the user to pick one of the value
var index := wall → pick string("what is your favorite color?", "pick one of the choices", choices)
  • pick string returns the index of the item selected. You can retrieve the actual value using at.
var choice := choices → at(index)
If the user does not select any value, index will be -1.

invalid values

The user may decide to not give you any value. In such case, the value returned by the action will be invalid. You should always check values returned by the user for such case.
var name := wall → ask string("what is your name?")
if name → is invalid then
name := "not specified"
else ... end if

wall mode vs page mode

The default behavior of ask and pick actions is the display a new element on the wall.
However when used within a page, a modal dialog will be displayed instead displaying the wall.