I want to get a text filed value in controller action using rails 3.This text filed value is normal value and not within the rails form.Check my below code.
homes/home/_good.html.erb:
<div class="block-content" style="display:none;">
<div class="timeline-container">
<div class="input-group bmargindiv1 col-md-6 pull-left"><span class="input-group-addon text-left"><div class="leftsidetextwidth">Receipt No :</div></span>
<input type="text" class="form-control" value= "<%= @sdf.Receipt_No %>" >
</div>
<div class="input-group bmargindiv1 col-md-6 pull-left"><span class="input-group-addon text-left"><div class="leftsidetextwidth">Date & Time :</div></span>
<input type="text" class="form-control" value= "<%= @sdf.Created_On %>" >
</div>
<div class="input-group bmargindiv1 col-md-6 pull-left"><span class="input-group-addon text-left"><div class="leftsidetextwidth">Deceased Name :</div></span>
<input type="text" class="form-control" value= "<%= @hcsy.Deceased_Name %>">
</div>
<div class="input-group bmargindiv1 col-md-6 pull-left"> <span class="input-group-addon text-left"><div class="leftsidetextwidth">Donor Name :</div></span>
<input type="text" class="form-control" value= "<%= @sdf.Doner_Name %>" >
</div>
<div class="input-group bmargindiv1 col-md-12 pull-left"> <span class="input-group-addon text-left"><div class="leftsidetextwidth">Amount :</div></span>
<input type="text" class="form-control" value= "<%= @good.Amount %>">
</div>
<div class="clearfix"></div>
</div>
<div class="block block-themed themed-asphalt">
<div class="block-title"><h5>Office Use</h5></div>
<div class="block-content full">
<%= form_for :vendor,:url => {:action =>"payment" } do |f| %>
<div class="totalaligndiv">
<div class="input-group bmargindiv1 col-md-6" style="margin:auto; float:none;"><span class="input-group-addon text-left"><div class="leftsidetextwidth">Select Vendor :</div></span>
<%= f.select(:v_name,options_for_select(Vendor.where(s_catagory: "Puja Samagree").pluck(:v_name),selected: "Select vender name"),{},{:class => "form-control"}) %>
</div>
<div class="clearfix"></div>
<div class="tbpaddingdiv1 text-center">
<%= f.submit "Add to Payment",:class => "btn btn-success" %>
</div>
<div class="clearfix"></div>
</div>
<% end %>
</div>
</div>
</div>
<!--end_2nd_total_div-->
controller/homes_controller.rb:
class HomesController < ApplicationController
def home
@sdf=TSdf.new
respond_to do |format|
format.html
format.js
end
end
def scan_report
if @sdf=TSdf.find_by_Receipt_No(params[:sdf][:Receipt_No])
@hcsy=THcsy.find_by_Sdp_Id(@sdf.Sdp_Id)
@hcsy_deatils=THcsyDetails.find_by_HCSY_ID(@hcsy.id)
@woods=THcsyFundTypeMaster.find_by_Fund_Type_Code(1)
@burn=THcsyFundTypeMaster.find_by_Fund_Type_Code(2)
@good=THcsyFundTypeMaster.find_by_Fund_Type_Code(3)
@swd=THcsyFundTypeMaster.find_by_Fund_Type_Code(5)
@photo=THcsyFundTypeMaster.find_by_Fund_Type_Code(6)
@vendor=Vendor.new
flash[:notice]=" number matched"
else
splitted = params[:sdf][:Receipt_No].split('/')
receipt = splitted[0]
table_id = splitted[1]
@sdfs=TSdf.find_by_Receipt_No(receipt)
if @sdfs
@hcsys=THcsy.find_by_Sdp_Id(@sdfs.Sdp_Id)
@fund_details=THcsyFundTypeMaster.find_by_Fund_Type_Code(table_id)
else
flash[:notice]="Scan number not found"
end
end
end
def payment
@vendor=AddToPaymentVendor.create()
end
end
I want to save Receipt_No which is shown in the above view page inside create method in payment action.Please help me to resolve this issue.
Aucun commentaire:
Enregistrer un commentaire