Forum: Ruby on Rails in_place_editor_field -- values not clickable

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.
2837408ba0375c40b235f0a5a5107d37?d=identicon&s=25 Doug Livesey (biot023)
on 2006-03-14 21:04
Hallo -- I've just installed the latest stable version of rails, and am
following the rails recipies book's first recipie -- using
in_place_editor_field.
My problem is that the code throws no error, but the resulting fields
are not editable -- the values just come up as text, rather than
clickable-then-editable fields.
Can anyone help shed any light on why this might be the case?
Cheers,
   doug.
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 Pat Maddox (pergesu)
on 2006-03-14 21:09
(Received via mailing list)
Make sure you have
<%= javascript_include_tag :defaults %>

in your page/layout's head.

Pat
2837408ba0375c40b235f0a5a5107d37?d=identicon&s=25 Doug Livesey (biot023)
on 2006-03-14 21:16
Pat Maddox wrote:
> Make sure you have
> <%= javascript_include_tag :defaults %>
>
> in your page/layout's head.
>
> Pat

Yeah, that's definately there. The layout is called 'contacts.rhtml' and
looks like this:

<html>
<head>
  <title>Contacts: <%= controller.action_name %></title>
  <%= stylesheet_link_tag 'scaffold' %>
  <%= javascript_include_tag :defaults %>
</head>
<body>
<p style="color: green"><%= flash[:notice] %></p>
<%= @content_for_layout %>
</body>
</html>

And the page is called 'show.rhtml' and is like this:

in Contact.content_columns %>
<p>
  <b><%= column.human_name %>:</b>
  <%= in_place_editor_field :contact, column.name %>
</p>
<% end %>
<%= link_to 'Back', :action => 'list' %>


When they render, there's javascript stuff in there, but it's not doing
what it's supposed to -- for reference, a look at the source of one of
the fields is:

<p>
  <b>Name:</b>
  <span class="in_place_editor_field"
id="contact_name_1_in_place_editor">Fat Mary</span><script
type="text/javascript">
//<![CDATA[
new Ajax.InPlaceEditor('contact_name_1_in_place_editor',
'/contacts/set_contact_name/1')
//]]>
</script>
</p>

I'm no js guru, but it *looks* like it should be ok!
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 Pat Maddox (pergesu)
on 2006-03-14 21:24
(Received via mailing list)
On 3/14/06, doug livesey <biot023@gmail.com> wrote:
>
> </html>
>
> //<![CDATA[
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>

Offhand, the js looks fine.  Open the javascript console in Firefox,
clear any errors (you'll have a gazillion if you use gmail), and then
reload the page.  If there are any errors it will tell you
immediately..if not, try clicking it and see if any errors come up.
If there are still no errors and it still doesn't work, it's probably
your js settings.

Pat
2837408ba0375c40b235f0a5a5107d37?d=identicon&s=25 Doug Livesey (biot023)
on 2006-03-14 21:33
> Offhand, the js looks fine.  Open the javascript console in Firefox,
> clear any errors (you'll have a gazillion if you use gmail), and then
> reload the page.  If there are any errors it will tell you
> immediately..if not, try clicking it and see if any errors come up.
> If there are still no errors and it still doesn't work, it's probably
> your js settings.
>
> Pat

I suspect I might be getting a big 'ah-ha!' here, but I'm using IE6.
Should I not expect the AJAX stuff to work with IE, or even other
browsers that perhaps happen to have been to gmail?
Also, I've been looking in IE & not finding much about js help -- is
this a Firefox feature? Should I have firefox? I'm on an XP laptop.
2837408ba0375c40b235f0a5a5107d37?d=identicon&s=25 Doug Livesey (biot023)
on 2006-03-14 21:48
> I suspect I might be getting a big 'ah-ha!' here, but I'm using IE6.
> Should I not expect the AJAX stuff to work with IE, or even other
> browsers that perhaps happen to have been to gmail?
> Also, I've been looking in IE & not finding much about js help -- is
> this a Firefox feature? Should I have firefox? I'm on an XP laptop.

Well, I just downloaded Firefox, and have been rather delighted so far!
What it is telling me in the JavaScript console is this:

Error: Ajax.InPlaceEditor is not a constructor
Source File: http://localhost:3000/contacts/show/1
Line: 19

Unfortunately, I have no idea how to recify it, as I am simply following
a recipie in the hope of learing Ruby AJAX.
Does this suggest anything to you?
(& thanks very much for pointing me towards Firefox -- I reckon it could
well turn out to be an invalueable debugging tool!)
   doug.
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 Pat Maddox (pergesu)
on 2006-03-14 21:54
(Received via mailing list)
On 3/14/06, doug livesey <biot023@gmail.com> wrote:
> Should I not expect the AJAX stuff to work with IE, or even other
>
I think you should expect the js stuff to work..it's pretty simple js,
and it'd be pretty pointless if the helpers generated code that
doesn't work for the majority of users.  Is IE 6 the standard version,
or the early release (shows how much I use it :).  I'd recommend
installing Firefox just because it has great standards support, and is
nice for development - it's got a lot of dev-friendly features built
in.  Install firefox, load up the js console to diagnose any
errors..and if it works fine in Firefox, see if you can find a js
console in IE and diagnose it there.  Using Firefox to begin with
though will help you narrow the problem.

Pat
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 Pat Maddox (pergesu)
on 2006-03-14 21:57
(Received via mailing list)
On 3/14/06, doug livesey <biot023@gmail.com> wrote:
> Source File: http://localhost:3000/contacts/show/1
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>

hrm..do you have the latest javascripts installed?  Maybe you're
trying to do this on an old application.  Do rake update_javascripts
to..update the javascripts :)

That's probably not it, since my guess is you're running Rails 1.0 on
a brand new app.  If that's the case, then I really don't know what
the problem is.

Pat
2837408ba0375c40b235f0a5a5107d37?d=identicon&s=25 Doug Livesey (biot023)
on 2006-03-14 21:58
Pat Maddox wrote:
> On 3/14/06, doug livesey <biot023@gmail.com> wrote:
>> Should I not expect the AJAX stuff to work with IE, or even other
>>
> I think you should expect the js stuff to work..it's pretty simple js,
> and it'd be pretty pointless if the helpers generated code that
> doesn't work for the majority of users.  Is IE 6 the standard version,
> or the early release (shows how much I use it :).  I'd recommend
> installing Firefox just because it has great standards support, and is
> nice for development - it's got a lot of dev-friendly features built
> in.  Install firefox, load up the js console to diagnose any
> errors..and if it works fine in Firefox, see if you can find a js
> console in IE and diagnose it there.  Using Firefox to begin with
> though will help you narrow the problem.
>
> Pat

Cheers for that, & for Firefox!
Like I said above, it has pointed me to:

Error: Ajax.InPlaceEditor is not a constructor

Unfortuantely, I don't really know what to do w/ this!
2837408ba0375c40b235f0a5a5107d37?d=identicon&s=25 Doug Livesey (biot023)
on 2006-03-14 22:01
Pat Maddox wrote:
> On 3/14/06, doug livesey <biot023@gmail.com> wrote:
>> Source File: http://localhost:3000/contacts/show/1
>> Posted via http://www.ruby-forum.com/.
>> _______________________________________________
>> Rails mailing list
>> Rails@lists.rubyonrails.org
>> http://lists.rubyonrails.org/mailman/listinfo/rails
>>
>
> hrm..do you have the latest javascripts installed?  Maybe you're
> trying to do this on an old application.  Do rake update_javascripts
> to..update the javascripts :)
>
> That's probably not it, since my guess is you're running Rails 1.0 on
> a brand new app.  If that's the case, then I really don't know what
> the problem is.
>
> Pat

No -- the response I get to ruby -v is:
ruby 1.8.2 (2004-12-25) [i386-mswin32]

And I just installed the latest version of rails, too!
I tried the rake update_javascripts thing, but rake didn't seem to
recognise the command -- could that be a hint?
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 Pat Maddox (pergesu)
on 2006-03-14 22:12
(Received via mailing list)
On 3/14/06, doug livesey <biot023@gmail.com> wrote:
> > hrm..do you have the latest javascripts installed?  Maybe you're
> ruby 1.8.2 (2004-12-25) [i386-mswin32]
> http://lists.rubyonrails.org/mailman/listinfo/rails
>

Ruby version shouldn't matter.  You said you have the latest version
of Rails - just to make sure, type 'gem list rails' at the command
line.  You should get "rails (1.0.0)".  If not, you'll need to 'gem
update rails'.

To see all available tasks, type 'rake -T' in your app's root dir.
It'll give you a list of all the rake commands it recognizes, and
'rake update_javascripts' *should* be the last one on the list.  If
it's not there then something's wrong with your Rails install, and my
guess is that it's simply not up to date.  It *could* be some Windows
issue, I'm not sure.

Pat
2837408ba0375c40b235f0a5a5107d37?d=identicon&s=25 Doug Livesey (biot023)
on 2006-03-14 22:52
> Ruby version shouldn't matter.  You said you have the latest version
> of Rails - just to make sure, type 'gem list rails' at the command
> line.  You should get "rails (1.0.0)".  If not, you'll need to 'gem
> update rails'.
>
> To see all available tasks, type 'rake -T' in your app's root dir.
> It'll give you a list of all the rake commands it recognizes, and
> 'rake update_javascripts' *should* be the last one on the list.  If
> it's not there then something's wrong with your Rails install, and my
> guess is that it's simply not up to date.  It *could* be some Windows
> issue, I'm not sure.
>
> Pat

Hi again -- I've run the rails update commands, but still to no avail.
I still don't get the update_javascripts rake task, and I still get the
same error.
Perplexing!
I've even cleared all the caches & everything!
I guess I shall have thoroughly investigate just what I'm running!
from what I can tell, I'm up to date, but that doesn't seem to be the
case.
Thanks very much for your input,
   doug.
2837408ba0375c40b235f0a5a5107d37?d=identicon&s=25 Doug Livesey (biot023)
on 2006-03-14 23:11
Yeah, you were right!
The problem wasn't my Ruby or Rails installation -- it was Rad Rails for
Eclipse!
(Well, me being dumb', if we're going to be pedantic...)
I can't believe I didn't even think of that!
Sorry about that -- hope the sense of closure helps take the sting out!
& thanks very much again -- I would never have figured it out w/out your
input.
Cheers,
   doug.
E7349346374a0c685bf8055b7977af5c?d=identicon&s=25 Andrei Erdoss (cautaro)
on 2006-06-28 20:22
(Received via mailing list)
What was the solution to your problem, Doug? What was it in Rad Rails
that caused this problem?

I've been trying to figure this out all morning w/o luck. Please help.

Andrei
E7349346374a0c685bf8055b7977af5c?d=identicon&s=25 Andrei Erdoss (cautaro)
on 2006-06-28 20:30
(Received via mailing list)
Include the 'controls' library. Defaults library doesn't exist in these
later versions.



Will solve this issue.
2837408ba0375c40b235f0a5a5107d37?d=identicon&s=25 Doug Livesey (biot023)
on 2006-06-29 10:39
Andrei Erdoss wrote:
> Include the 'controls' library. Defaults library doesn't exist in these
> later versions.
>
>
>
> Will solve this issue.

Hi -- all I did upon realising this was scale back how much I relied
upon Rad Rails -- I just use it as an editor, really -- of course, I
still use Eclipse find/replace & SVN etc., so it's still worth having,
but by going back to the console for most things, I stay totally up to
date w/ features.
Cheers,
   doug.
This topic is locked and can not be replied to.