我在编辑表单中遇到了 ddslicks 的问题
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put , :multipart => true }) do |f| %>
#some code
<div class="field multi-select three cf">
<%= f.label :date_of_birth %>
<%= f.date_select(:date_of_birth, {:order => [:year, :month, :day],:start_year =>Time.now.year-50, :end_year => Time.now.year }) %>
</div>
<%= f.submit "Update", :class=>"btn-container submit" %>
<% end %>
生成下一个html:
<select id="user_date_of_birth_1i" name="user[date_of_birth(1i)]">
<option value="1962">1962</option>
<option value="1963">1963</option>
....
<select id="user_date_of_birth_2i" name="user[date_of_birth(2i)]">
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
....
<select id="user_date_of_birth_3i" name="user[date_of_birth(3i)]">
<option value="1">1</option>
<option value="2">2</option>
....
此时一切都很好,但是当我应用 ddslick 时它不起作用
这是我的 global.js
$('#user_date_of_birth_1i').ddslick({selectText: "Year", height: 200 });
$('#user_date_of_birth_2i').ddslick({selectText: "Month", height: 200});
$('#user_date_of_birth_3i').ddslick({selectText: "Day", height: 200});
它生成下一个 html
<div id="user_date_of_birth_1i" class="dd-container" style="width: 260px; ">
<div class="dd-select" style="width: 260px; background-color: rgb(238, 238, 238); background-position: initial initial; background-repeat: initial initial; ">
<input class="dd-selected-value" type="hidden" value="1992">
<a class="dd-selected"><label class="dd-selected-text">1992</label></a>
<span class="dd-pointer dd-pointer-down"></span>
</div>
<ul class="dd-options dd-click-off-close" style="width: 260px; height: 200px; overflow: auto; ">
<li><a class="dd-option"><input class="dd-option-value" type="hidden" value="1962">
<label class="dd-option-text">1962</label></a>
</li>
<li><a class="dd-option"> <input class="dd-option-value" type="hidden" value="1963">
<label class="dd-option-text">1963</label></a>
</li>
....rest of years
</div>
user_date_of_birth_2i(month), user_date_of_birth_3i(days) 相同
当我提交时,它不会保存该字段。(我正在使用设计),任何帮助将不胜感激