-1
我想用我的形式家屬場,但我的投入是不是hidde 我跟着這個教程https://www.driftingruby.com/episodes/dependent-form-fields家屬字段沒有藏在我的形式
我的application.js
//= require jquery
//= require jquery.turbolinks
//= require jquery_ujs
//= require turbolinks
//= require bootstrap-sprockets
//= require now-ui-kit
//= require bootstrap-datepicker
//= require bootstrap-switch
//= require moment.min
//= require nouislider.min
//= require jquery.bootstrap.wizard
//= require jquery.validate.min
//= require paper-bootstrap-wizard
//= require underscore
//= require dependent-fields
//= require_tree .
$(document).ready(function() {
DependentFields.bind()
});
我的觀點
<%= simple_form_for @contrat do |f| %>
<%= f.error_notification %>
<%= f.input :num_mandat, label: 'Numero Mandat' %>
<%= f.input :mandat_type, label: 'Type Mandat' %>
<%= f.input :client_type, label: 'Type de personne', collection: ['Physique', 'Morale'], id: 'client_choice' %>
<%= content_tag :div, class: 'js-dependent-fields', data: { 'data-select': 'client_choice', 'data-option-value': 'Physique'} do %>
<%= f.input :sexe_phi, collection: ['Mme', 'Mr'] %>
<% end %>
<%= f.button :submit, "Valider" %>
感謝您的幫助Dipak,我改變了我的代碼,但它仍然不工作 – Wako