Module: Editor
Version: 4.2.1 +
User: Developer
Difficulty: Medium
Introduction
In this exercise we will demonstrate the RepeatTarget functionality of the DropDownList
Prerequisites
- The Futurama Editor must be installed.
- Futurama Runtime must be installed.
- Completing the tutorial Adding interactivity to your website first, is recommended.
Description
This is a sequel of the Nationality exercise . You can download the basis for this exercise (the end-result of the Nationality exercise) by clicking here.
Assignment
In the Nationality exercise, the options in the DropDownlist were created by adding a different WebLabel for each person in the DataTable. When the table would hold a lot of persons, this would become a lot of work.
We can use the RepeatTarget property of the DropDownList to fill the DropDownList generically.
Take the following steps to do so:
- Create a Range from 0 to 3 with stepsize 1.
- Create a UserVariable type Long.
- In the DropDownList properties, refer to the Range in the RepeatData property, and to the UserVariable in the RepeatTarget property.
- Within the DropDownList, you now only need one WebLabel.
In this WebLabel, create a formula Index. Refer to the DataTable in the Table input. In the Row Input, refer to the UserVariable.
Tips
- Remember to select the webpage as your StartWebPage in your Document.
- The DefaultValue of the UserVariable has to be zero.
Solutions
Download
You can download our solution for this assignment by clicking the image at the right. (Futurama 4.2.1.2)
Please note that you can very well have a different solution that is just as good as ours.
Variations
- (Easy:) Add a row with another person to the DataTable. Alter your application so that your DropDownList is independent of the number of rows in it.
- (Medium:) In the DropDownList, display the names as: 'Person: '. Do not add this 'Person: '-text to the DataTable, but to the WebLabel in the DropDownList.