I need to ask to my user if will pay a service with credit card...if it checked the option pay_with_card? it must show the rest of the form, that ask for other data like car
Ok my solution is this: all the code in the view, if a user check pay_with_card...(mi code is in spanish) it shows the complete form...if is not checked don´t show nothing, just the same checkbox asking for payment... thanks guys.
function mostrar (){
var checkbox = document.getElementById('chk_tarjeta');
if (checkbox.checked)
document.getElementById("card_details").style.display = "block";
else
document.getElementById("card_details").style.display = "none";
Forma de Pago
<%= form_for(@product) do |f| %>
<%= f.label :paga_con_tarjeta? %>
<%= f.check_box :paga_con_tarjeta, :id => "chk_tarjeta", :onclick => "mostrar();" %>
<%= f.label :numero_de_tarjeta %>
<%= f.text_field :numerotarjeta %>
<%= f.label :codigo_de_seguridad %>
<%= f.text_field :codigoseguridad %>