Form Blocks

Hi,

How do I get a value out of a form block
eg.
<% form_for :order do |form_block| %>
<%= form_block.text_field :name, :size => 40 %>
<% end %>

If within that block I wanted to get the value of an attribute like
age, how cold you get that from the form_block instance? eg
form_block.age (i realise this does not work). I could just do
@order.age but I need to check from a helper where the block is only
sen to it.

Thanks

I think, you trying to implement something like observe field on name
to get age.
You can
<%= observe_field 'order_name',
      :frequency => 1,
      :update => "UPDATE_SPAN/DIV/TEXTFIELD_ID_OF_AGE",
      :url => {:action => 'YOUR_ACTION_TO_GET_AGE '}%>

For more info on this ajax, refer this:
http://wiki.rubyonrails.org/rails/pages/observe_field+-+Passing+Parameters

Regards.

Hi Carolene,

Unfortunately, I have not explained myself properly... Great answer
though!

What I meant is:-
<% form_for :order do |form_block| %>
<%= form_block.text_field :name, :size => 40 %>
<% some code here that could return the value of age that refers to
age via form_block (not @order) eg form_block.age %>
<% end %>

Hi --