There's an example on the IPE Wiki page showing exactly how to do  
this. It's pretty simple -- you store a reference to the editor, then  
call its dispose() method when you're done with it.

Here's a clip from a working instance, although this is quite old and  
may have some 1.5 weirdness in it.

        var editor = new Ajax.InPlaceEditor(
                thing_to_edit,
                'server_script.php',{
                        callback: function(form,value){
                        /* do something here to identify what you're editing*/
                        },
                        ajaxOptions: {
                                onComplete: function(){
                                        this.dispose();
                                }
                        }
                }
        });
        editor.enterEditMode('click');

Walter

On May 8, 2009, at 11:11 AM, mtm81 wrote:

>
> Hi,
> I need several inplaceeditors on the screen, therefore I've included
> the inplaceeditor code into a function so that each instance is only
> generated when the user actually clicks the button to edit..
>
> However if I click cancel on that instance and then click to edit
> again, the previous instance still shows so I end up with a doubled up
> inplace text box/select box.
>
> I know I simply need to destroy the previous version on either sucess
> or cancellation.
>
> Here's my current function.. how do I amend this to destory it??
>
> thanks loads for any replies...
>
> mtm81
>
> function addnewselect(CategoryID) {
> new Ajax.InPlaceSelect('details_defaultnominal_' + CategoryID,
> 'includes/inc_editinplace_process.asp', [<%=NominalArray_Values%>], [<
> %=NominalArray_Names%>], {callback: function(value,text) { return
> 'UpdateFieldName 
> = 
> NominalCode 
> &UpdateTblName 
> = 
> Suppliers_Products_Categories 
> &UpdateUniqueIDName=CategoryID&UpdateUniqueID='
> +CategoryID +'&UpdateValue='+escape(value)}, cancelControl:'button',
> highlightcolor: 'transparent'});
>
> }
> >


--~--~---------~--~----~------------~-------~--~----~
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