我试图让我的选择字段预填充两个与信用卡到期月/年相关的选择字段,显然我做错了什么:
在这种情况下,字段应选择03作为默认月份,将2026作为默认年份。
CMS_TOOLBAR_HIDE
这就是生成的HTML在月份中的样子:
<div class="form-group">
<%= label_tag "Card Expiration", nil, required: true, class: "control-label col-md-3 col-sm-3 col-xs-4" %>
<div class="col-md-2 col-sm-2 col-xs-6">
<%= select_tag :exp_month, options_for_select(Date::MONTHNAMES.compact.each_with_index.map { |name,i| ["#{i+1} - #{name}", i+1] }), include_blank: false, "data-stripe" => "exp-month", class: "form-control", selected: @card.exp_month %>
</div>
<div class="col-md-2 col-sm-2 col-xs-6">
<%= select_tag :exp_year, options_for_select((Date.today.year..(Date.today.year+10)).to_a), selected: @card.exp_year, include_blank: false, "data-stripe" => "exp-year", class: "form-control" %>
</div>
</div>
这就是生成的HTML年份的样子:
<select class="form-control" data-stripe="exp-month" id="exp_month" name="exp_month" selected="selected"><option value="1">1 - January</option>
<option value="2">2 - February</option>
<option value="3">3 - March</option>
<option value="4">4 - April</option>
<option value="5">5 - May</option>
<option value="6">6 - June</option>
<option value="7">7 - July</option>
<option value="8">8 - August</option>
<option value="9">9 - September</option>
<option value="10">10 - October</option>
<option value="11">11 - November</option>
<option value="12">12 - December</option>
</select>
我还验证了<select class="form-control" data-stripe="exp-year" id="exp_year" name="exp_year" selected="selected"><option value="2016">2016</option>
<option value="2017">2017</option>
<option value="2018">2018</option>
<option value="2019">2019</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
<option value="2022">2022</option>
<option value="2023">2023</option>
<option value="2024">2024</option>
<option value="2025">2025</option>
<option value="2026">2026</option>
</select>
和@card.exp_month = 1
。
答案 0 :(得分:0)
添加“默认选项”作为第二个arg:
fc.getConfigurationObject().setText("");
=A1+index({1;1;1;1;1;3;2};weekday(A1))