Displaying 1 result from an estimated 1 matches for "get_phone_typ".
Did you mean:
get_phone_types
2007 May 09
0
How can I specify the selected value in collection_select when fieldname different than variable?
...e is "phone".
Main form snippet
[code]
<h2>Phones</h2>
<table>
<%
n = 0
for phone in @phones do
fieldname = "phone_#{n}";
%>
<tr><td>Number:</td><td> <%= text_field_tag fieldname, phone.number%></
td> <td><%= get_phone_types fieldname%></td></tr>
<%
n += 1
end
%>
<table>
[/code]
helper with get_phone_types
[code]
#
#Create a Phone type select List
#Take a list of html options
#
def get_phone_types(fieldname)
@phones = PhoneType.find(:all, :order => "description ASC&qu...