Hi Darryl,

I'm completelly agree with the solution of Walter.
But I still try to do what you want wITH autocompleter.

I made some tests and it results in:

<div id="test1"> this is my test1 text </div>
<div id="test2"> this is my test2 text </div>
<button id='clicker'>Edit</button>
<button id='saver' style="display:none" onclick="goLeaveMe()">Save</
button>

    <script type="text/javascript">
    function goLeaveMe(){
//    alert('go');
      $('saver').hide();
      _oIPE1.leaveEditMode()
      _oIPE2.leaveEditMode();
    }

var _oIPE1=new Ajax.InPlaceEditor( 'test1', '#',
{externalControlOnly:true,externalControl:'clicker',
 
okControl:false,cancelControl:false,
                                       onEnterEditMode: function() { /
*alert('enter');*/$('saver').show(); }});
var _oIPE2=new Ajax.InPlaceEditor( 'test2', '#',
{externalControlOnly:true,externalControl:'clicker',
 
okControl:false,cancelControl:false,
                                       });



try it :))
but I'm sure you'll have to fit to your need.

--
david

On 10 mar, 17:15, Walter Lee Davis <wa...@wdstudio.com> wrote:
> 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