Ruby on Rails
Wednesday, June 22, 2016
On 2016-Jun-22, at 04:20 , Padmahas Bn <padmahas@gmail.com> wrote:Hi,
I'm not using any form in this web page. I only have labels, text boxes and links with parameters.
The text_field code is<div class="field">
<%= label_tag("Member code") %>
<%= text_field_tag :member_code, nil, class: 'form-control' %>
</div>
The link_to code is<%= link_to "Joint and Personal loan (Ajax not implemented)", jlpl_prints_path(member_code: 'member_code'), :class => "btn btn-danger", method: :post %>
member_code: 'member_code'
and just have:
member_code: member_code
However, you will have a form in your page due to the use of method: :post in your link_to; it's just a generated form.
As others have said, you'll need to do some Javascript (perhaps with a library like jQuery) to get the value of a field at the time the link is clicked without using a form.
-Rob
in the controller I printed member_code to verify whats the value I'm getting.member_code = params[:member_code]
puts"***********Inside controller member_code received is #{member_code} **************"
The thing is its printing the output in the console as
**************Inside controller member_code received is member_code******************
Why is that? I've filled text_field with value 180 but I'm getting the variable itself but not the value of it. Is form_tag is necessary to get this to work?
Thank you.--
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/3e05f0ea-f2f7-401f-b614-0a39a6920788%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment