> On 2016-Jun-22, at 04:20 , Padmahas Bn <[email protected]> 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 %>
You want to remove the quotes from the value:
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 [email protected]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/3e05f0ea-f2f7-401f-b614-0a39a6920788%40googlegroups.com
>
> <https://groups.google.com/d/msgid/rubyonrails-talk/3e05f0ea-f2f7-401f-b614-0a39a6920788%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/FC7C64A2-2725-4777-95F4-265D3BD3812F%40gmail.com.
For more options, visit https://groups.google.com/d/optout.