English 中文(简体)
我在把一个职位与两个核对箱连接起来方面存在问题,这两个箱是所有者的通信和居民通信。
原标题:I have a problem in linking a stand with two checkboxes owner communication and resident communication
  • 时间:2009-10-12 08:20:19
  •  标签:

我在试图将一站与两个固定箱连接起来时存在问题;通信,如果选择一个以上位置,似乎分开存放。

如果我有一个立场的话,参数似乎以正确的方式储存在一个阵列中,但一旦我加入同一阵列的另一种立场,则似乎挥发了 has。 我的看法也一样。 此外,还有另一种选择,即增加另一立场,即:

- unless @stands.empty?
%tr#show_stands.contentText
%td{:width => "27%", :valign => "top"}
  Select Stand For Ownership
%td{:width => "15%", :valign => "top"}
  = collection_select "owned_stands[]", "stand_id", @stands, :id, :erf_no_rr_no,  options ={:prompt =>"Please select stand..."}, {:class =>  dropdownSelect }
   
   
%td{:valign => "top"}
  = check_box_tag "owned_stands[][owner_comm_list]"
  Add to Owners Communication list
  = check_box_tag "owned_stands[][resident_comm_list]"
  Add to Residents Communication list

我期望有一个阵列,它包含两轮或两轮以上,取决于我所选择的席位数目。 如果我选择了一个职位和两个检查箱,我期望散列如下:

([{"stand_id" => "1", "resident_comm_list" => "1", "owner_comm_list" => "1"}])

如果我有两个期望:

([{"stand_id" => "1", "resident_comm_list" => "1", "owner_comm_list" =>    "1"},{"stand_id" => "2", "resident_comm_list" => "1", "owner_comm_list" => "1"}])

但现在,如果我选择两个立场的话,我发现:

 ([{"stand_id" => "1", "resident_comm_list" => "1"}, {"owner_comm_list" =>    "1"},{"stand_id" => "2"},{"resident_comm_list" => "1", "owner_comm_list" => "1"}])

而且,当我不得不通过轮.选择旁遮盖时,我就给我的控制员留下错误。

问题回答

问题在于,你的检查箱子——标签没有适当界定在寄生虫中应适合什么地方。

铁路通常使所有开关容易,而不需要你去做硬.。 不幸的是,当你再次尝试使用一系列检查箱时,这些方便方法失败了。 由于,check gotcha 关于违约数值和阵列。

你使用检查箱——标签可以避免 go,但要求你填写通常由表格标出的信息。

令我看,你们所有来自多个部分的领域都在同一个布道阵列中增加。 铁路在一阵列中处理重复碎片的方式是启动另一个指数。

很好地审视了源头,在取得正确结果时,作为lu子。

你颁布的法典要求我们作出太多的努力,才能达到我可以与之一道发挥作用的地步。 因此,我无法保障这项工作。 而且,没有张贴控制员守则,也没有任何办法说明为什么会犯错误。

不管解决办法如何,你都希望为每一部分增加一个指数。

你们希望这样做。 如果指数是每一部分的独特数值。

- unless @stands.empty?
%tr#show_stands.contentText
%td{:width => "27%", :valign => "top"}
  Select Stand For Ownership
%td{:width => "15%", :valign => "top"}
  = collection_select "owned_stands[#{index}][]", "stand_id", @stands, :id, :erf_no_rr_no,  options ={:prompt =>"Please select stand..."}, {:class =>  dropdownSelect }
   
   
%td{:valign => "top"}  
  = check_box_tag "owned_stands[#{index}][owner_comm_list]"
  Add to Owners Communication list
  = check_box_tag "owned_stands[#{index}][resident_comm_list]"
  Add to Residents Communication list

It will produce params hash like these: For one stand with both checkboxes:

params["owned_stands"] =
  {"0" =>  
    {"stand_id" => 1, "owner_comm_list" => 1, "resident_comm_list" => 1}
  }

有两个检查箱:

prams[owned_stands] = 
 {
  "0" =>  
    {"stand_id" => 1, "owner_comm_list" => 1, "resident_comm_list" => 1}, 
  "1" => 
    {"stand_id" => 2, "owner_comm_list" => 1, "resident_comm_list" => 1}
 }

你们可能要看是否接受——为使用而设的田地。 它们简化了这种观点和管制人员,但仍然是检查箱的 pre。





相关问题
热门标签