Ruby on Rails Thursday, July 9, 2015

On 9 July 2015 at 00:57, Padmahas Bn <padmahas@gmail.com> wrote:
> I have
>
> <%= label_tag :"Enter member code" %>
> <%= text_field_tag :membercode%>
>
> <%= button_to "Death/Retired Recovery Letter Printing",
> recovery_letter_rpts_path(membercode: membercode) %>
>
>
> In my controller
>
> def create
> membercode = params[:membercode]
> exist = Member.find_by_member_code(membercode)
> respond_to do |format|
> if exist.nil?
> # format.html{ redirect_to new_recovery_url, notice: 'Member not
> found.'} # here you just echo the result
> puts "******************************************"
> puts "This is the member code #{membercode}" # done
> puts "******************************************"
> redirect_to(recoveries_path)
> else
> puts "This is the NO member code #{membercode}"
> redirect_to(recoveries_path)
> end
> end
> end
>
>
> all I want to do is send membercode which is accepted via text_field_tag to
> the create action of the controller. And there is no form to contain these
> fields. I want it that way because, there will be more "button_to" which
> want to send membercode to different controller's action.

Put the field in a form, then you can have multiple submit buttons
within the form.

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsvkHMVgame3Rz%3DBND_nXd9DCWkPNOY2iS_hASKELx7Kw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment