Rails Textbox question


#1

Hi All,

I have a table and in it is a cell like this:

<td>
  <%=text_field_tag 'quantity', line_item.quantity, {:size => 1} %>
</td>

So, when the page loads, this text box will contain the quantity value
of my
line_item.

Down below, I give the user the option to change the quantity of the
line
item and then update their cart.

The link looks like this:

<%=link_to ‘Update Quantity’, :controller => ‘cart’, :action =>
‘update_line_item_quantity’, :new_quantity => quantity, :line_item_index
=>
line_item_index %>

The :new_quantity => quantity part doesn’t work.

What’s the proper way to refer to the value of the contents of the text
box?

Thanks for any help!


Terry (TAD) Donaghe
http://tadspot.tumblr.com


#2

Erm, you want to update link_to value with what’s in the text box? If
so, that’ll be AJAX.

Or if you mean, the pre-set quantity is @line_item.quantity

Zach I.
→ Blog — http://www.zachinglis.com
→ Company — http://www.lt3media.com
→ Portfolio — http://portfolio.zachinglis.com


#3

I’m trying to get it working with link_to_remote now… :slight_smile: I have a
problem, though because I’m adding multiple rows dynamically… almost
there, but time for bed.

On 5/6/07, Zach I. // LT3media removed_email_address@domain.invalid wrote:

line_item_index %>
http://tadspot.tumblr.com


Terry (TAD) Donaghe