IOWA form question

M

Mark Probert

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.
 
K

Kirk Haines

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?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,156
Messages
2,570,878
Members
47,408
Latest member
AlenaRay88

Latest Threads

Top