Avaliar valor armazendo após seleção de um radio button
Boa noite, sou begginer total..., haha, estou com uma aplicacao em estudo/teste e na index tenho uma situação de 2 radios button disabled / enabled. Porem quando "enabled" esta selecionado, não posso permitir que salve, sem preenche(selecionar) dado em um select que compõe essa index.
Alguém poderia me ajudar, ou, passar o link de algum exemplo/projeto???
Minha def no controller:
def create
@recharge = Organization::Recharge.new(recharge_params)
@recharge.balancebellow = Money.from_amount(recharge_params[:balancebellow_cents].to_f)
@recharge.balancerecharge = Money.from_amount(recharge_params[:balancerecharge_cents].to_f)
@recharge.organization = active_organization
respond_to do |format|
if @recharge.save
flash[:notice] = "Your order was successfully created."
format.html { redirect_to controller: :corporate_users, action: :index }
format.json { render :show, status: :created, location: @recharge }
else
flash[:notice] = "Your order are not created."
format.html { redirect_to controller: :corporate_users, action: :index }
format.json { render json: @recharge.errors, status: :unprocessable_entity }
end
end
end
Trecho do index:
#AR-Modal.modal.fade{:role => "dialog"}
.modal-dialog
Modal content
.modal-content
= form_for @new_recharge, url: organization_recharges_path, :html => {:method => :post} do |f|
.modal-header
%button.close.def-cctype{"data-dismiss" => "modal", :type => "button"}
%h4.modal-title.header-modal.font-color Configure Auto-Recharge
.modal-body.body-modal
%div.top-tfext
We`ll only charge your payment method when your balance falls below the amount you set.
.row.col-md-12.row-auto-recharge-style
.col-md-6.ar-label-align.pull-left
AUTO RECHARGE
.col-md-6.radio-stl
.radio.radio-success
.col-md-6
.pull-left
= f.radio_button :autorecharge, 'false', checked: true
= f.label :autorecharge, 'DISABLED', :value => 'false'
.col-md-6
.pull-left
= f.radio_button :autorecharge, 'true'
= f.label :autorecharge, 'ENABLED', :value => 'true'
.row.col-md-12.row-auto-recharge-style
.col-md-6.model-label-align.pull-left
= f.label :balancebellow_cents, "IN THE BALANCE FALLS BELLOW"
.col-md-6.pull-left
.controls
.sel2-style
= select("organization_recharge",:balancebellow_cents, [10,15,20,25,30,35,40,45,50], {include_blank: '--- Please select ---', class: "form-control"})
.row.col-md-12.row-auto-recharge-style
.col-md-6.model-label-align.pull-left
= f.label :balancerecharge_cents, "RECHARGE THE BALANCE TO"
.col-md-6.pull-left
.controls
.sel2-style
= select("organization_recharge",:balancerecharge_cents, [10,20], {include_blank: '--- Please select ---', class: "form-control"})
#cctype-mode.row.col-md-12.row-auto-recharge-style
.col-md-6.model-label-align.pull-left
PAYMENT METHOD
.col-md-6.pull-left
.form-actions.payment-method
.col-md-4.pull-left
.controls
.payment-ty-text
= @cc_default.try(:card_type)
.col-md-8
.payment-ty-text-2.pull-left
**** **** ****
.controls
.payment-ty-text-3.pull-left
= @cc_default.try(:digits)
.col-md-4
.mod-cctype
%p
%span.call-select Change
#sel-mode.row.col-md-12.row-auto-recharge-style
.col-md-6.model-label-align.pull-left
PAYMENT METHOD
.col-md-6.pull-left
.form-actions.payment-method
.col-md-6.pull-left
.controls
.payment-ty
= select("organization_recharge",:organization_payment_method_id, @ccs.collect {|cc| [ "#{cc.card_type} #{cc.digits}", cc.id ] }, {selected: @cc_default.try(:id), class: "form-control"})
.modal-footer
.col-md-12
.pull-right
%button.btn.btn-success.btn-cons{type:"submit"}
Save
.pull-right
%button.btn.btn-cons.cancel-confirm.def-cctype{"data-dismiss" => "modal", :type => "button"}
CancelDiscussão (0)
Carregando comentários...