Forum: Ruby on Rails in_place_editor and no access to value

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Brian N. (Guest)
on 2006-05-20 07:20
I have the following in my rhtml and I get an error that 'value' does
not exist. This looks like the examples that I have seen so I am not
sure what I am doing wrong. If I take off the :with part, I get a value
parameter passed to my controller, but then I can't figure out how to
get the country id passed like I need to.

          <%= in_place_editor 'add_country_area',
	      :url => {:action => 'add_country_area'},
	      :with =>
"'value='+escape(value)+'country='+document.add_trip.country.selectedIndex"
%>

Thanks for the help
Brian
Mark Reginald J. (Guest)
on 2006-05-20 15:27
(Received via mailing list)
Brian N. wrote:
> I have the following in my rhtml and I get an error that 'value' does
> not exist. This looks like the examples that I have seen so I am not
> sure what I am doing wrong. If I take off the :with part, I get a value
> parameter passed to my controller, but then I can't figure out how to
> get the country id passed like I need to.
>
>           <%= in_place_editor 'add_country_area',
> 	      :url => {:action => 'add_country_area'},
> 	      :with =>
> "'value='+escape(value)+'country='+document.add_trip.country.selectedIndex"

Try :with =>
"Form.serialize(form) + '&country=' +
document.add_trip.country.selectedIndex"

--
We develop, watch us RoR, in numbers too big to ignore.
Brian N. (Guest)
on 2006-05-20 23:18
Mark Reginald J. wrote:
> Brian N. wrote:
>> I have the following in my rhtml and I get an error that 'value' does
>> not exist. This looks like the examples that I have seen so I am not
>> sure what I am doing wrong. If I take off the :with part, I get a value
>> parameter passed to my controller, but then I can't figure out how to
>> get the country id passed like I need to.
>>
>>           <%= in_place_editor 'add_country_area',
>> 	      :url => {:action => 'add_country_area'},
>> 	      :with =>
>> "'value='+escape(value)+'country='+document.add_trip.country.selectedIndex"
>
> Try :with =>
> "Form.serialize(form) + '&country=' +
> document.add_trip.country.selectedIndex"
>
> --
> We develop, watch us RoR, in numbers too big to ignore.

That worked! Any reason why the way I was doing it didn't work?
Thanks a lot!
Anatol P. (Guest)
on 2006-05-21 07:31
For some reason some time ago Scriptaculous developers remove 'value'
parameter from callbacks. See http://dev.rubyonrails.org/ticket/3529

I believe that it is a 'feature' not a bug.

Brian N. wrote:
> Mark Reginald J. wrote:
>> Brian N. wrote:
>>> I have the following in my rhtml and I get an error that 'value' does
>>> not exist. This looks like the examples that I have seen so I am not
>>> sure what I am doing wrong. If I take off the :with part, I get a value
>>> parameter passed to my controller, but then I can't figure out how to
>>> get the country id passed like I need to.
>>>
>>>           <%= in_place_editor 'add_country_area',
>>> 	      :url => {:action => 'add_country_area'},
>>> 	      :with =>
>>> "'value='+escape(value)+'country='+document.add_trip.country.selectedIndex"
>>
>> Try :with =>
>> "Form.serialize(form) + '&country=' +
>> document.add_trip.country.selectedIndex"
>>
>> --
>> We develop, watch us RoR, in numbers too big to ignore.
>
> That worked! Any reason why the way I was doing it didn't work?
> Thanks a lot!
This topic is locked and can not be replied to.