%= form_for @subscription, :url => subscription_path(@subscription.subscription_id), :html => {:method => :put, :class => 'form-horizontal'} do |f| %>
<% end %>
<%= javascript_tag do %>
function onTypeChange() {
var value = $("input[type=radio]:checked").val();
if (value == "DEFAULT") {
$("#form_requested_date").hide();
$("#form_policy").hide();
} else if (value == "POLICY") {
$("#form_requested_date").hide();
$("#form_policy").show();
} else if (value == "DATE") {
$("#form_policy").hide();
$("#form_requested_date").show();
}
}
$(document).ready(function() {
onTypeChange();
$( "input[type=radio]").on("click", function() {
onTypeChange();
});
});
<% end %>