# In\_place\_editor\_field fun! Possible to pass more parameters

**URL:** <https://www.ruby-forum.com/t/in-place-editor-field-fun-possible-to-pass-more-parameters/73359>\
**Category:** Rails\
**Created:** [October 24, 2006, 3:05am UTC](https://www.ruby-forum.com/t/in-place-editor-field-fun-possible-to-pass-more-parameters/73359 "2006-10-24T03:05:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sw0rdfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/edb3f5/32.png) [@sw0rdfish](https://www.ruby-forum.com/u/sw0rdfish)\
**Post date:** [October 24, 2006, 3:05am UTC](https://www.ruby-forum.com/t/in-place-editor-field-fun-possible-to-pass-more-parameters/73359/1 "2006-10-24T03:05:47Z")

</div>

Hey guys…

I’m wondering if there is way to submit extra parameters with

\<%= in\_place\_editor\_field :model, :attribute %\>

For example, if I wanted to submit the current time or something like  
that to run through my own custom set\_model\_attribute method that is  
called when the editor is saved.

Thanks in advance

p.s. sorry if this is a double post, I think my first attempt failed.

---

<div class="post-metadata">

**Author:** ![sw0rdfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/edb3f5/32.png) [@sw0rdfish](https://www.ruby-forum.com/u/sw0rdfish)\
**Post date:** [October 24, 2006, 6:54am UTC](https://www.ruby-forum.com/t/in-place-editor-field-fun-possible-to-pass-more-parameters/73359/2 "2006-10-24T06:54:18Z")

</div>

On 10/24/06, sw0rdfish [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> called when the editor is saved.  
> The :with option is used to construct the parameter string to return

> :with:JavaScript snippet that should return what is to be sent in the AJAX  
> call, form is an implicit parameter

So you need to have a string that will eval to Javascript on the client  
side.

Hope that’s what your after 🙂

---

<div class="post-metadata">

**Author:** ![sw0rdfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/edb3f5/32.png) [@sw0rdfish](https://www.ruby-forum.com/u/sw0rdfish)\
**Post date:** [October 24, 2006, 7:18am UTC](https://www.ruby-forum.com/t/in-place-editor-field-fun-possible-to-pass-more-parameters/73359/3 "2006-10-24T07:18:19Z")

</div>

I’m pretty sure that is what I’m after, and I tried using that 100  
times, maybe I’m just useless.

How would I go about passing a string using the “with” command?

---

<div class="post-metadata">

**Author:** ![sw0rdfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/edb3f5/32.png) [@sw0rdfish](https://www.ruby-forum.com/u/sw0rdfish)\
**Post date:** [October 24, 2006, 7:26am UTC](https://www.ruby-forum.com/t/in-place-editor-field-fun-possible-to-pass-more-parameters/73359/4 "2006-10-24T07:26:20Z")

</div>

On 10/24/06, sw0rdfish [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’m pretty sure that is what I’m after, and I tried using that 100  
> times, maybe I’m just useless.
> 
> How would I go about passing a string using the “with” command?

My javascript.fu is not strong. It’s my understanding that you need to  
construct the parameters for the url in javascript. I’m sure there are  
nicer ways of doing this.

…  
:with =\> “‘param\_name=’ + $(‘dom\_id’).value + ‘&param\_2\_name=’ +  
some\_js\_function\_that\_returns\_an\_encoded\_string()”

I believe something like that. I think there are things in prototype.js  
to  
assist with this. Serialize on forms may help.  
You need a string within a string. The above starts with a " for rubys  
sake, then immediately has a single ’ for js. Anything in the single  
will  
be a literal for js, and anything just in the double " will be executed  
in  
js as a function.

---

<div class="post-metadata">

**Author:** ![sw0rdfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/edb3f5/32.png) [@sw0rdfish](https://www.ruby-forum.com/u/sw0rdfish)\
**Post date:** [October 24, 2006, 5:23pm UTC](https://www.ruby-forum.com/t/in-place-editor-field-fun-possible-to-pass-more-parameters/73359/5 "2006-10-24T17:23:35Z")

</div>

Found a solution,

for Archieval purposes… just use RJS files, here’s a cool walk  
through;

[http://www.shanesbrain.net/articles/2006/01/19/in-place-editor-with-rjs-templates](http://www.shanesbrain.net/articles/2006/01/19/in-place-editor-with-rjs-templates)

It’s 100 times easier.

---

<div class="post-metadata">

**Author:** ![sw0rdfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/edb3f5/32.png) [@sw0rdfish](https://www.ruby-forum.com/u/sw0rdfish)\
**Post date:** [October 24, 2006, 7:54am UTC](https://www.ruby-forum.com/t/in-place-editor-field-fun-possible-to-pass-more-parameters/73359/6 "2006-10-24T07:54:30Z")

</div>

I’ll check it out. Thanks for your help.

Although I guarantee my “javascript.fu” is worse than yours.

---

<div class="post-metadata">

**Author:** ![sw0rdfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/edb3f5/32.png) [@sw0rdfish](https://www.ruby-forum.com/u/sw0rdfish)\
**Post date:** [October 24, 2006, 5:34pm UTC](https://www.ruby-forum.com/t/in-place-editor-field-fun-possible-to-pass-more-parameters/73359/7 "2006-10-24T17:34:34Z")

</div>

On 10/25/06, sw0rdfish [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> It’s 100 times easier.  
> That is much nicer. Thanx for linking
