# Rails Textbox question

**URL:** <https://www.ruby-forum.com/t/rails-textbox-question/103496>\
**Category:** Rails\
**Created:** [May 7, 2007, 5:57am UTC](https://www.ruby-forum.com/t/rails-textbox-question/103496 "2007-05-07T05:57:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Terry\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/cc9497/32.png) [@Terry\_D](https://www.ruby-forum.com/u/Terry_D)\
**Post date:** [May 7, 2007, 5:57am UTC](https://www.ruby-forum.com/t/rails-textbox-question/103496/1 "2007-05-07T05:57:42Z")

</div>

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](http://tadspot.tumblr.com)

---

<div class="post-metadata">

**Author:** ![Terry\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/cc9497/32.png) [@Terry\_D](https://www.ruby-forum.com/u/Terry_D)\
**Post date:** [May 7, 2007, 7:29am UTC](https://www.ruby-forum.com/t/rails-textbox-question/103496/2 "2007-05-07T07:29:46Z")

</div>

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](http://www.zachinglis.com)  
â†’ Company â€” [http://www.lt3media.com](http://www.lt3media.com)  
â†’ Portfolio â€” [http://portfolio.zachinglis.com](http://portfolio.zachinglis.com)

---

<div class="post-metadata">

**Author:** ![Terry\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/cc9497/32.png) [@Terry\_D](https://www.ruby-forum.com/u/Terry_D)\
**Post date:** [May 7, 2007, 7:35am UTC](https://www.ruby-forum.com/t/rails-textbox-question/103496/3 "2007-05-07T07:35:46Z")

</div>

I’m trying to get it working with link\_to\_remote now… 🙂 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](mailto:removed_email_address@domain.invalid) wrote:

> line\_item\_index %\>  
> [http://tadspot.tumblr.com](http://tadspot.tumblr.com)
> 
> >

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