next up previous contents
Next: About this document ... Up: Sample Code Previous: MICdo   Contents


Multiple Values

Consider the following code snippets:

from multiple.fs:

...
<MICdefine name="selector" data="AtomicData::Text" type="HTMLIO::Select">
"daniel";;
{
  $field-&gt;display({multiple => 3}};
  $field-&gt;set_possible_hash({zane => Zane,
				daniel => Daniel,
				charles => Charles,
				sam => Sam,
				micheal => Michael});
}
</MICdefine>
...

The above creates a field that will display itself as a select box with the multiple param set to three and the items as indicated in the anonymous hash passed to set_possible. Daniel (value daniel) will be highlighted/selected initially.
*******
from select.html:

<html><body>

<form action="overridden" MICfieldspace="multiple">
Please select everyone to invite to your party:<br>
<MICinput name="selector"><br>

<input type="submit" name="select_submit" 
 value="Submit">
<MICsubmit name="select_submit" value="Submit" 
 goto="display">
</MICsubmit>
</form>

</html></body>
*******
from display.html:
<html><body>

<form action="none" MICfieldspace="multiple">
The revelers are:<br>
<MIClist iterator="$reveler" 
 list="$fs-&gt;get_field(`selector')-&gt;value()">
<b>$reveler</b><br>
</MIClist>

<input type="submit" name="multiple_submit" 
 value="Revise">
<MICsubmit name="multiple_submit" value="Revise"
 goto="select">

<input type="submit" name="multiple_submit" 
 value="Done">
<MICsubmit name="multiple_submit" value="Done"
 goto="done">

</form>
</body></html>
*******
If we point a user to the select page, they will get a 3-row select box with the name `Daniel' highlighted. On this page, the field will contain the single value, `daniel.' Suppose the user selects `Charles,' `Sam,' and `Michael' (poor Zane) and hits submit. They will then go the display page and be presented with the names `Daniel,' `Charles,' `Sam,' and `Michael'E.1. Remember that `Daniel' was never deselected. The fieldspace now contains `daniel,' `michael,' `charles,' and `sam.' They then hit the `Revise' button and are taken back the revise page. The fieldspace contains all value but `zane' and the select box has all names selected except `Zane.' The user then selects `Zane' and deselects `Daniel' and resubmits. Now, we behave as before with `Zane' and `zane' substituted for `Daniel' and `daniel.' Happy with the arrangements, the user then hits `Done' and it does its trivial thing.


next up previous contents
Next: About this document ... Up: Sample Code Previous: MICdo   Contents