mardi 14 août 2018

i want to recive value from 'bootstrap Custom forms' in Ruby

<%= form_for :content, url: contents_path, method: :post do |f| %>

  <%= f.label :inout %> <!-- 수입 지출 목록 -->
  <%= f.text_field :inout %><br>

  <div class="input-group mb-3">
    <div class="input-group-prepend">
      <label class="input-group-text" for="inputGroupSelect01">Options</label>
    </div>
    <select class="custom-select" id="inputGroupSelect01">
    <option selected>Choose...</option>
    <option value="1">결혼식</option>
    <option value="2">장례식</option>
    <option value="3">돌잔치</option>
    </select>
  </div>

  <% if option == 1? %>
    <%= f.hidden_field :category, value=>"결혼식" %>
  <% end %>

  <%= f.label :title %>
  <%= f.text_field :title %>

  <%= f.label :cost %>
  <%= f.text_field :cost %>

  <%= f.label :memo %>
  <%= f.text_area :memo %>

  <%= f.submit %>
<% end %>

if i select option value one, i store "결혼식" in category

and i want to see "결혼식" in show view

but now my program occur error enter image description here

how can i do?

Aucun commentaire:

Enregistrer un commentaire