Gerard Petersen
2006-Jan-28 13:12 UTC
[Rails] Auto drop list: Create a form professional or easy?
Hi all,
I''m searching for a method to dynamically build a form. ( false/true
field in
the DB should automatically be a droplist)
If you use "_form.rhtml" it works easy, with only this code in your
partial,
but uses the extra file, and doesn''t feel profi and flexible.
<%= start_form_tag :action => ''create_product'' %>
<%= render :partial => ''form'' %>
<%= submit_tag ''Edit'' %>
<%= end_form_tag %>
If you do it like below, it looks really good and feels flexible, but that
won''t auto-create the droplists.
<%= start_form_tag :action=> "create_product" %>
<table class="tablehack">
<tr><th>Field</th><th>Contents</th></tr>
<% for column in Product.content_columns %>
<tr class="ListLine<%= cycle("0","1")
%>">
<td><%= column.human_name %>:</td>
<td><%= text_field ''product'', column.name
%></td>
</tr>
<% end %>
</table>
<input type="submit" value="Save" />
<%= end_form_tag %>
Any suggestions of you guru''s are most welcome!!!!
Regards,
Gerard.
--
"Who cares if it doesn''t do anything? It was made with our new
Triple-Iso-Bifurcated-Krypton-Gate-MOS process ..."
My $Grtz =~ Gerard;
~
:wq!
