在第一页的表单输入后出现.a bootsrap模式出现有两个按钮,如一个被命名为“是”,第二个被命名为“否”,我想将yes按钮的值保存为true而没有按钮false.my视图如下
<%= form_tag storesignup_is_taxable_path, :method =>
:post, :id=>'tax-btn', :remote => true do %>
<div class="md-modal md-effect-10" id="gst_applicable">
<div class="md-content">
<h3>GST</h3>
<div class="text-center">
<div class="gst_tax_apply">
<p>Does GST applicable to you or your business?
</p>
<input name="authenticity_token" value="<%=
form_authenticity_token %>" type="hidden">
<input type="hidden" class="form-control otp-input"
name='tax_applicable' id='tax_applicable' >
<button type="submit" class="" id='tax-btn' ></button>
<button class="btn gst_enable"
onclick="document.getElementById('tax_applicable').value =
'1';document.getElementById('tax-btn').click();" > Yes</button>
<button class="btn gst_dissable"
onclick="document.getElementById('tax_applicable').value =
'2';document.getElementById('tax-btn').click();">No</button>
</div>
<button type="button" class="md-close btn btn-close">close</button>
</div>
</div>
</div>
<% end %>
我的控制器
def is_taxable
@data.update_attributes(:tax_applicable => params[:is_taxable])
@data.save
render js: ''
end
PLZ帮助iam严重陷入困境并且对rails来说是新手