I think the easiest way to do this will be to write your own editor  
view, and substitute that for a portion of your regular page using  
Ajax.Updater. That way you'll be able to customize it to the thing  
you're editing pretty directly. It's a long slog extending the  
InPlaceEditor to give it extra custom form elements.

Let's say you had:

<div class="item" id="post_123">
<h2>Headline here</h2>
<div class="body">
<p>buncha text</p>
<p>buncha text</p>
<p>buncha text</p>
</div>
<img class="edit_me" ... />
</div>

You could access this like so:

$$('div.item img.edit_me').each(function(elm){
        elm.observe('click',function(evt){
                Event.stop(evt);
                var block = this.up('div.item');
                var item = block.id.replace(/post_/,'');
                new Ajax.Updater(block,'get_editor.php',{
                        parameters:{id:item},
                        evalScripts:true
                });
        });
});

get_editor.php would get the details of post #123, present an HTML  
form laid out to match, and would include the requisite Prototype code  
to submit via Ajax (read up on the request() method) and to replace  
its parent DIV with the results of a successful submission (or a  
meaningful error message).

$('form_123').observe('submit',function(evt){
        Event.stop(evt);
        this.request({
                evalScripts:true,
                onComplete: function(transport){
                        $('post_123').update(transport.responseText);
                }
        });
});

That's how I would do it, I'd certainly like to learn another way if  
anyone has a better idea.

Walter

On Mar 10, 2009, at 8:18 AM, Darryl wrote:

>
> Hi David,
>
> I would like to be able to click the edit button on one field, for
> example the title and then edit the title, description and other
> fields at the same time and then save them using a single 'Save'
> button and save all the fields.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to