IOWA form question

I am trying to create an edit form based on text records. The record
format looks like, [label:group:comment]. For example:

  fred:Name:fred comment
  apple:Fruit:best crunchy
  bill:Name:bill comment
  john:Name:john comment
  banana:Fruit:best firm

I have a record struct

  RecStruct = Struct.new("RecStruct", :label, :group, :comment, :val)

So, I want the 'Add' form to look something like:

  Label Group Comment
  <text field> <option box> <text field>

Q1: How do I get the option group into the field?

My current version of this is:

        <table>
            <tr>
                <th>Label</th>
                <th>Group</th>
                <th>Comments</th>
            </tr>
          <repeat oid="recList">
            <tr>
                <td><input type="text" oid="rec.label"></td>
                <td><select oid="grpList">
                      <option oid="selgrp">
                    </select>
                </td>
                <td><input type="text" oid="rec.comment"></td>
            </tr>
          </repeat>
        </table>

Though it won't really work because the "recList" oid is expecting a text
value rather than a select list.

Q2: How do I extract the currently selected value and place it in the
    record?

There will be one selected value per line. Should they be in an array?

Thanks, once again.

···

--
-mark. (probertm @ acm dot org)

You're close.

For your select box:

<select oid="grpList">
  <option oid="rec.group"/>
</select>

And then in your binding:

grpList {
  item = rec.group
  list = groups
}

That way, the select box will reflect the state of rec.group when the form
is generated, and when someone changes the form, rec.group will have the new
value.

Make sense?

Kirk Haines

···

On Fri, 27 Aug 2004 07:30:35 +0900, Mark Probert wrote

My current version of this is:

        <table>
            <tr>
                <th>Label</th>
                <th>Group</th>
                <th>Comments</th>
            </tr>
          <repeat oid="recList">
            <tr>
                <td><input type="text" oid="rec.label"></td>
                <td><select oid="grpList">
                      <option oid="selgrp">
                    </select>
                </td>
                <td><input type="text" oid="rec.comment"></td>
            </tr>
          </repeat>
        </table>

Though it won't really work because the "recList" oid is expecting a
text value rather than a select list.

Q2: How do I extract the currently selected value and place it in
the record?