Here's what I'm attempting to do. On my "Create Assignment" , I want the "Link" question to ONLY be showed if the dropdown on assignment_type has "Video" selected.
<%= render 'shared/errors', obj: @assignment %>
<%= form_for(@assignment, :html => {class: "form-horizontal", role: "form"}) do |f| %>
<div class="form-group">
<div class = "xtrapadding">
<%=f.label "Select Unit(s) for Assignment"%>
<%= f.collection_select(:unit_ids, Unit.all, :id, :name, {placeholder: "Units"}, {multiple: true} )%>
</div>
<div class="form-group">
<%= f.label :assignment_type %>
<%= f.select :assignment_type, options_for_select(Assignment.options, params[:type]), {}, required: true, class: 'form-control' %>
</div>
<div>
<%= f.text_field :name, class:"form-control", placeholder: "Title of Assignment", autofocus: true %>
</div>
<div class="field">
<b><%= f.label :description %></b>
<%= f.rich_text_area :description %>
</div>
<div>
<%= f.text_field :duedate, class: "datepicker", placeholder: "Due Date"%>
</div>
<div>
<%= f.text_field :link, class:"form-control", placeholder: "Insert video link", autofocus: true %>
</div>
<div class="form-group" id="submitbutton">
<div align = "center">
<%= f.submit class: "btn waves-effect waves-light" %>
</div>
</div>
</div>
<%end%>
It's that last question I want to show or hide based off of the link. I want it to default to hidden, but to be visible when the dropdown is selected with a certain value. I'm fairly sure I need to use Ajax, but other than that I'm not quite sure where to start. Thanks! By the way, I'm using Webpacker and Rails 6.