# In-place form editing

**URL:** <https://www.ruby-forum.com/t/in-place-form-editing/58124>\
**Category:** Rails\
**Created:** [April 18, 2006, 6:45pm UTC](https://www.ruby-forum.com/t/in-place-form-editing/58124 "2006-04-18T18:45:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![robtotheb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/db5fbb/32.png) [@robtotheb](https://www.ruby-forum.com/u/robtotheb)\
**Post date:** [April 18, 2006, 6:45pm UTC](https://www.ruby-forum.com/t/in-place-form-editing/58124/1 "2006-04-18T18:45:12Z")

</div>

Ive been following the rails recipes (great book) and wanted to have a  
larger a text field when editing in place.

The chapter it mentions that I can “force the InPlaceEditor to create  
either a text ï¬eld or a ï¬eld, using the :rows option to  
in\_place\_editor\_ï¬eld( ). Then any value greater than 1 will tell  
InPlaceEditor to generate a .” It doesn’t elaborate and Im  
not sure on the correct way to write it.

I presume you just have to update the view file only (i might be wrong)

my view is -

\<% for column in Contact.content\_columns %\>

\<%= in\_place\_editor\_field :contact, column.name%\>

\<% end %\> \<%= link\_to ' Back' , :action =\> ' list' %\>

---

<div class="post-metadata">

**Author:** ![robtotheb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/db5fbb/32.png) [@robtotheb](https://www.ruby-forum.com/u/robtotheb)\
**Post date:** [April 18, 2006, 7:05pm UTC](https://www.ruby-forum.com/t/in-place-form-editing/58124/2 "2006-04-18T19:05:34Z")

</div>

Hello Rob,

2006/4/18, Rob B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> \<%= in\_place\_editor\_field :contact, column.name%\>

The options go after the column, so in your case, you’d do it this way:  
\<%= in\_place\_editor\_field :contact, column.name, :rows =\> 2, :cols =\> 50  
%\>

If you go to the Rails API at [http://api.rubyonrails.com/](http://api.rubyonrails.com/), you can  
find the declaration of #in\_place\_editor\_field, and take it from  
there.

Hope that helps !

---

<div class="post-metadata">

**Author:** ![robtotheb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/db5fbb/32.png) [@robtotheb](https://www.ruby-forum.com/u/robtotheb)\
**Post date:** [April 18, 2006, 7:55pm UTC](https://www.ruby-forum.com/t/in-place-form-editing/58124/3 "2006-04-18T19:55:35Z")

</div>

FranÃ§ois Beausoleil wrote:

> Hello Rob,
> 
> 2006/4/18, Rob B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
> 
> > \<%= in\_place\_editor\_field :contact, column.name%\>
> 
> The options go after the column, so in your case, you’d do it this way:  
> \<%= in\_place\_editor\_field :contact, column.name, :rows =\> 2, :cols =\> 50  
> %\>
> 
> If you go to the Rails API at [http://api.rubyonrails.com/](http://api.rubyonrails.com/), you can  
> find the declaration of #in\_place\_editor\_field, and take it from  
> there.
> 
> Hope that helps !

Thanks. I thought that would work but the boxes are still one line.

---

<div class="post-metadata">

**Author:** ![robtotheb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/db5fbb/32.png) [@robtotheb](https://www.ruby-forum.com/u/robtotheb)\
**Post date:** [April 19, 2006, 12:02am UTC](https://www.ruby-forum.com/t/in-place-form-editing/58124/4 "2006-04-19T00:02:26Z")

</div>

Rob B. wrote:

> FranÃ§ois Beausoleil wrote:

[…]

> > The options go after the column, so in your case, you’d do it this way:  
> > \<%= in\_place\_editor\_field :contact, column.name, :rows =\> 2, :cols =\> 50  
> > %\>

[…]

> Thanks. I thought that would work but the boxes are still one line.

That’s because in\_place\_editor\_field takes _two_ hashes in its  
parameter list. You have to specify which one.

Try this:

\<%= in\_place\_editor\_field :foo, :bar, {}, {:rows =\> 4, :cols =\> 75} %\>

-Drew

---

<div class="post-metadata">

**Author:** ![robtotheb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/db5fbb/32.png) [@robtotheb](https://www.ruby-forum.com/u/robtotheb)\
**Post date:** [April 28, 2006, 11:59pm UTC](https://www.ruby-forum.com/t/in-place-form-editing/58124/5 "2006-04-28T23:59:43Z")

</div>

It’s unfortunate that the API doesn’t give enough information to  
understand this – and a person has to ask on list for answers.

The API:

> in\_place\_edit\_for(object, attribute, options = {})

The answer:

> \<%= in\_place\_editor\_field :foo, :bar, {}, {:rows =\> 4, :cols =\> 75} %\>

Ben
