How does one generate a form within a view using javascript?

Specifically, assume views/premise/new.html.erb looks like this:

<%= form_for(Premise.new) do |f| %>
  <%= f.hidden_field :full_address, :value => $FULL_ADDRESS %>
  <%= f.hidden_field :geocoding, :value => $GEOCODING %>
  <%= f.submit :value => "use this address" %>
  <%= f.label :formatted_address, $FULL_ADDRESS %>
<% end %>

... but with the twist that this form must be generated on the client
side by javascript.  (In this case, $GEOCODING and $FORMATTED_ADDRESS
are placeholders for values generated by the Google geocoding service,
which requires client-side javascript.)

One approach would be to look at the HTML generated by the above .erb
code and write javascript functions that emit HTML directly. But this
approach reeks -- there must be a better way!

Assuming there is a better way, where do I look for documentation and
examples?

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to