How to Let Users Save and Retrieve Text

In many cases you may want to ask the user a question and then later display the answer.  Some common examples of information you might want the user to enter:

With Forio Broadcast, you can save any user-entered information with a special form field and display it at any time during the run.  

Saving User Entered Text

In Forio Broadcast, text can be saved and retrieved by using a unique key.  The key can be any string or name, for example "mystrategy".

To save the text, simply create use a message form field.  This is a field that starts with  "M_" followed by the key name.  For example, you could name the field "M_mystrategy".  You can use either a input HTML form field (for one line input) or a textarea form field (for multiple line input).

Here's an example of a one line input and a longer textarea box.

 
<HTML>
<HEAD>
<TITLE>Start Page</TITLE>|
</HEAD>
<BODY>

<FORM method="POST" action="page2.htm">

<P>What is your name? <BR
<input type="text" name="M_name">

<P>Tell me a little about yourself:<BR>
<textarea name="M_about" rows="5" columns="60"></textarea>

<P><input type="submit" name="submit" value="Submit">
</FORM>
</BODY>
</HTML>
 

 

which will look something like this, when displayed:

 

Displaying Saved Text

To retrieve and display saved text, use the $Messages reference.  This is a keyed list, so you can retrieve the message with $Messages.get( key ).  For references that go over multiple lines and include returns, use the $MultiLineMessages reference (not shown), which substitutes <BR> statements for carriage returns.

For example:

 
<HTML>
<HEAD>
<TITLE>Start Page</TITLE>
</HEAD>
<BODY>

<FORM method="POST" action="page2.htm">
Welcome, $Messages.get("name").  Good luck on the sim!
</FORM>

</BODY>
</HTML>
 

 

displays a page similar to the following: