> ... - most of the time if I'm editing a value I
> probably also need to send the id of the record

The ID can be in the URL for the form submission, or if not there, you
can append it to the request with the callback() handler.

> or on return I have to
> update other values to match the one that was edited.

For that I would typically turn evalScripts on (htmlResponse:false)
and have my response contain one or more lines of raw JavaScript to
execute. Optionally you could use an onComplete handler as well.

> ... How about refactoring this code out into a
> dynamic form builder

The Ajax.InPlaceEditor and it's related classes just made through a
major overhaul with the most recent version of Scriptaculous, it's now
easier to customize and also less code, easier to understand.

Also, as Tobie said, subclassing (or wrapping/extending)
Ajax.InPlaceEditor is a pretty straight forward way to bend it to your
individual needs.

-justin


On Jan 14, 2008 10:54 AM, Steve Prior <[EMAIL PROTECTED]> wrote:
>
> [EMAIL PROTECTED] wrote:
> > Can InPlaceEditor be configured (or modified) so that upon an edit, it
> > accepts from the server a replacement for a different DOM sub-tree?
> > How do I do this?
>
> I've been thinking about the InPlaceEditor and how specialized it really
> turns out to be.  Without hacking it, the only situation it works in is
> for one field to be edited and returned without sending any other values
> to the server and only updating the one value on return.  This actually
> seems like a rare case to me - most of the time if I'm editing a value I
> probably also need to send the id of the record, or on return I have to
> update other values to match the one that was edited.
>
> It seems that maybe the functionality of the InPlaceEditor might be much
> more useful if it were broken up into pieces which could be used
> together in full compatibility with what's there now, but also by
> themselves for more flexibility.  So much of the editor's real bang for
> the buck is the dynamic form it creates, after that a lot of the other
> pieces are pretty simple.  How about refactoring this code out into a
> dynamic form builder which can take an existing element, save the old
> contents, and fill it with some form variants (simple text field, pull
> down selector, <insert your idea here>.  This would be amazingly useful!
>
> Steve
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to