Css_fields_for in CSSFormBuilder

Trying to use CSSFormBuilder, but having a problem with its
css_fields_for wrapper. When I check out the code, there’s a fairly
important-looking line commented out. Is anyone using this? Is that
method broken, or have I just not figured it out, yet? If you aren’t
using this, what other good form builders are there?

Here’s what I have:

<%= error_messages_for ‘customer’ %>

<% fieldset_tag ‘General Data’ do %>
<%= @f.text_field :name, :class=>‘double-size’ %>
<%= @f.text_field :ein, :class=>‘normal-size’ %>


<%= @f.text_field :product, :class=>‘double-size’ %>


<% end %>
<%= error_messages_for ‘address’%>
<% fieldset_tag ‘Address’ do %>
<% css_fields_for :address, do |addr| %>
<%= addr.text_field :street, :class=>‘normal-size’ %>


<%= addr.text_field :city, :class=>‘normal-size’ %>


<%= addr.text_field :zip, :class=>‘quarter-size’ %>
<%= addr.text_field :state, :class=>‘normal-size’ %>


<%= addr.text_field :county, :class=>‘normal-size’ %>
<%= addr.text_field :country, :class=>‘normal-size’ %>
<% end %>
<% end %>

Here’s the error I get in my Customer.new method:

compile error
script/…/config/…/app/views/customers/_form.rhtml:12: parse error,
unexpected kDO_BLOCK
_erbout.concat “\t”; css_fields_for :address, do |addr| ;
_erbout.concat “\n”
^
script/…/config/…/app/views/customers/_form.rhtml:25: parse error,
unexpected kEND, expecting $

Extracted source (around line #12):

Thanks!

Hi Doug, (?)

redbaritone wrote:

Trying to use CSSFormBuilder, but having a
problem with its css_fields_for wrapper.

I haven’t used this helper yet, but had a reader with a migrations
problem
recently and it sorta looks like the same thing. Same syntax in the
line.
Same error message. So here’s something to try.

Here’s what I have:
<% css_fields_for :address, do |addr| %>

Here’s the error I get in my Customer.new method:
unexpected kDO_BLOCK
_erbout.concat “\t”; css_fields_for :address, do |addr| ;

Try removing the comma after :address. In a migration, it signals Rails
(I
think) to expect a directive (like :force => true) before the block.
The
reader got an ‘unexpected kDO_BLOCK’ error when he had a comma but no
directive, and the error went away when he removed the comma. Might be
a
similar situation here.

hth,
Bill

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs