English 中文(简体)
铁路3.1 接口设计——减少排放,形成投入
原标题:Rails 3.1 interface design - Cascading dropdown, form input

For a case where I have models like:

  • Coutries
  • States
  • Cities
  • Opinions

I d like to begin with just presenting a user with a dropdown for Coutries.
Once a country is selected, then a States dropdown would appear below Countries.
Once a State is selected, then a Cities dropdown would appear below States.
Once a City is selected, a textboxt appears and the user writes their opinion of the city.
Once text is placed in the textbox, a submit button appears.
Once the user clicks submit I process the form data.

I d like to populate each dropdown from a corresponding table using the previous selection to limit the dropdown items.
I d like the same sort of functionality with checkboxes too.

Basically, I d like to be able to define a cascading form input scheme. I have seen some information on the topic, but nothing that wraps it up tight for Rails 3. For instance:
Rails 3.1 Dependent / Cascading Dropdowns and
Rails 3.1 interdependent select dropdown lists

... seem to offer only partial solutions. I am getting the feeling that I might be missing some fundamental Rails concept and that this (seemingly common) task should be easier. I want to streamline the user input experience. My models have a lot of good default data that I d like to present to the user as they make their input choices. I just can t seem to get it all on one page.

我在寻求“Rails动态形式的投入”时,没有获得我所寻求的搜索结果,“Rails Cascadingdown”搜索帮助了一些人。 “Rails活性形式”使我成为互联网史的一部分。

Can someone guide the way?

感谢!


ADDENDUM
This seems to allude to the trouble I have stumbled upon: http://guides.rubyonrails.org/form_helpers.html#building-complex-forms Perhaps that s my answer?

最佳回答

我认为这是走到这里的道路。 现在,我没有一位专家来讨论与“贱民”有关的问题,但我希望我至少能够把你置于正确的方向。 为了完成您的随行名单,你可以展示并隐藏根据前一份变化选定的投入。 从那里,我将看看一个叫做“支离破碎”的JQuery图书馆。 该图书馆将允许你在各州只选择与选定国家相关的国家。 我确实有两边的有链式图书馆的工作例子,我可以举例说明你是否愿意,而且我确信,那里有许多例子可以躲藏起来,并显示在“Query”的构成要素。

问题回答

暂无回答




相关问题
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: ...

热门标签