English 中文(简体)
形式:nes田生产无法使用/无效的标志
原标题:Formtastic: nested fieldsets produce unusable/invalid markup

我试图将相关的属性归入“杜布尔地区”,将其归入一个表格。 投入组:

<%= semantic_form_for MyModel.new do |f| %>
    <%= f.inputs  Advanced  do %>
        <%= f.input :name %>
        <%= f.inputs  Min/Max , class:  doublefield  do %>
          <%= f.input :min %>
          <%= f.input :max %>
        <% end %>
        <%= f.inputs  Zip/Place , class:  doublefield  do %>
          <%= f.input :zip %>
          <%= f.input :place %>
        <% end %>
    <% end %> 
<% end %>

然而,这产生了这样的标志(不可否认的标志):

<form accept-charset="UTF-8" action="my_model" class="formtastic" id="new_my_model" method="post" novalidate="novalidate">  
    <fieldset class="inputs">
        <ol>
                <li class="string input optional stringish" id="my_model_name_input">
                    ...
                </li>
                <li class="input">
                    <fieldset class="doublefield">
                        ...
                    </fieldset>
                </li>
                <fieldset class="doublefield">
                    ...
                </fieldset>
        </ol>
    </fieldset>
</form>

Only the first nested fieldset in the fieldset gets surrounded by the <li> tag, the others are just rendered as <fieldset> which leads to invalid markup (<fieldset> as direct child of <ol> is not allowed). This isn t just ugly but also makes it hard to apply styles to the form.

在我的研究中,我对关于这一问题的一些评论感到困惑,其中我说,这本可能是一个充满热情的问题,但我直到现在才找到了工作或建议。

任何想法?

FCCC/SBI/2008/INF.1。

  • rails (3.2.0.beta bd4bd3f)
  • formtastic (2.0.0.rc4 7d3bb2f)
  • ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]

Full markup:

<form accept-charset="UTF-8" action="my_model" class="formtastic" id="new_my_model" method="post" novalidate="novalidate">
<div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓">
    <input name="authenticity_token" type="hidden" value="zPm0lLyT6MM4M+LI1b7c9d7NqGQM2PiT+kHsjUnfTWM="></div>
    <fieldset class="inputs">
        <legend><span>Advanced</span></legend>
            <ol>
                <li class="string input optional stringish" id="my_model_name_input">
                    <label class=" label" for="my_model_name">Name</label>
                    <input id="my_model_name" maxlength="255" name="my_model[name]" type="text">
            </li>
                <li class="input">
                    <fieldset class="doublefield">
                        <legend><span>Min/Max</span></legend>
                    <ol>
                        <li class="number input optional stringish" id="my_model_min_input">
                            <label class=" label" for="my_model_roosts_min">Min</label>
                            <input id="my_model_min" maxlength="4" name="my_model[min]" step="any" type="number">
                        </li>
                        <li class="number input optional stringish" id="my_model_max_input">
                            <label class=" label" for="my_model_max">Max</label>
                            <input id="my_model_roosts_max" maxlength="4" name="my_model[max]" step="any" type="number">
                        </li>
                    </ol>
                </fieldset>
            </li>
                <fieldset class="doublefield">
                    <legend><span>Zip/Place</span></legend>
                    <ol>
                    <li class="string input optional stringish" id="my_model_zip_input">
                        <label class=" label" for="my_model_zip">Zip</label>
                        <input id="my_model_zip" maxlength="255" name="my_model[zip]" type="text">
                    </li>
                    <li class="string input optional stringish" id="my_model_place_input">
                        <label class=" label" for="my_model_place">Place</label>
                        <input id="my_model_place" maxlength="255" name="my_model[place]" type="text">
                    </li>
                </ol>
            </fieldset>
        </ol>
    </fieldset>
</div>

最佳回答
问题回答

暂无回答




相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签