[Proto-Scripty] scripty inplace editor

2013-01-27 Thread Phil Petree
Hi All!

I'm implementing the scriptaculous inplace editor and I have it working
except for one small detail:

If I activate the editor, click cancel, activate the editor again I get two
inplace editors.  cancel those and activate again and I get three.  cancel
those and activate again and I get four... and on and on and on...

What's the trick to this?  Here's my code:

html:
Homer Simpson

javascript:
function editName(element, id)
{
  new Ajax.InPlaceEditor(element, 'name_inpl_ajax.php', {
  okText: " Save ",
  cancelControl: "button",
  callback: function(form, value) {
  return 'id=' +id + '&name='+encodeURIComponent(value)
  }
  });
}

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




Re: [Proto-Scripty] scripty inplace editor

2013-01-27 Thread Walter Lee Davis

On Jan 27, 2013, at 4:10 PM, Phil Petree wrote:

> Hi All!
>  
> I'm implementing the scriptaculous inplace editor and I have it working 
> except for one small detail:
>  
> If I activate the editor, click cancel, activate the editor again I get two 
> inplace editors.  cancel those and activate again and I get three.  cancel 
> those and activate again and I get four... and on and on and on...
>  
> What's the trick to this?  Here's my code:
>  
> html:
> Homer Simpson
>  
> javascript:
> function editName(element, id)
> {
>   new Ajax.InPlaceEditor(element, 'name_inpl_ajax.php', { 
>   okText: " Save ",
>   cancelControl: "button",
>   callback: function(form, value) {
>   return 'id=' +id + '&name='+encodeURIComponent(value)
>   }
>   });
> }
> 

This editor isn't behaving as documented lately, I had an occasion to upgrade a 
working editor to the latest versions of Prototype and Scriptaculous, and found 
that clicking to edit the second time would cause the editor to load the 
editing form itself for editing. Not a good time for my client!

You might want to look at this option:

> Removing the behavior
> To disable the InPlaceEditor behavior later on, store it in a variable like:
> 
> var editor = new Ajax.InPlaceEditor('product_1'
> ,...);
>  (... 
> do
>  stuff ..)
>  editor.dispose();
> 
> This way, you can enable and disable " In Place Editing 
> ":http://madrobby.github.com/scriptaculous/in-place-editing at will.
> 

See if that can work around the issue for you.

Walter

-- 
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.
Visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Proto-Scripty] scripty inplace editor

2013-01-27 Thread Phil Petree
Thanks Walter.

I tried that already and found the editor to be essentially disabled (you
could click but not get the form).
On Jan 27, 2013 6:14 PM, "Walter Lee Davis"  wrote:

>
> On Jan 27, 2013, at 4:10 PM, Phil Petree wrote:
>
> > Hi All!
> >
> > I'm implementing the scriptaculous inplace editor and I have it working
> except for one small detail:
> >
> > If I activate the editor, click cancel, activate the editor again I get
> two inplace editors.  cancel those and activate again and I get three.
>  cancel those and activate again and I get four... and on and on and on...
> >
> > What's the trick to this?  Here's my code:
> >
> > html:
> > Homer Simpson
> >
> > javascript:
> > function editName(element, id)
> > {
> >   new Ajax.InPlaceEditor(element, 'name_inpl_ajax.php', {
> >   okText: " Save ",
> >   cancelControl: "button",
> >   callback: function(form, value) {
> >   return 'id=' +id + '&name='+encodeURIComponent(value)
> >   }
> >   });
> > }
> >
>
> This editor isn't behaving as documented lately, I had an occasion to
> upgrade a working editor to the latest versions of Prototype and
> Scriptaculous, and found that clicking to edit the second time would cause
> the editor to load the editing form itself for editing. Not a good time for
> my client!
>
> You might want to look at this option:
>
> > Removing the behavior
> > To disable the InPlaceEditor behavior later on, store it in a variable
> like:
> >
> > var editor = new Ajax.InPlaceEditor('product_1'
> > ,...);
> >  (...
> > do
> >  stuff ..)
> >  editor.dispose();
> >
> > This way, you can enable and disable " In Place Editing ":
> http://madrobby.github.com/scriptaculous/in-place-editing at will.
> >
>
> See if that can work around the issue for you.
>
> Walter
>
> --
> 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.
> Visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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.
Visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Proto-Scripty] scripty inplace editor

2013-01-27 Thread Jason Westbrook
So the actual problem is that you are creating multiple inplace editors -
create it once and let the inplace editor handle the click events

I answered a similar question in more depth on StackOverflow

http://stackoverflow.com/questions/14306045/codeigniter-script-aculo-us-inplaceedit-produces-duplicates-on-update/14313622#14313622

Jason Westbrook | T: 313-799-3770 | jwestbr...@gmail.com


On Sun, Jan 27, 2013 at 3:24 PM, Phil Petree  wrote:

> Thanks Walter.
>
> I tried that already and found the editor to be essentially disabled (you
> could click but not get the form).
> On Jan 27, 2013 6:14 PM, "Walter Lee Davis"  wrote:
>
>>
>> On Jan 27, 2013, at 4:10 PM, Phil Petree wrote:
>>
>> > Hi All!
>> >
>> > I'm implementing the scriptaculous inplace editor and I have it working
>> except for one small detail:
>> >
>> > If I activate the editor, click cancel, activate the editor again I get
>> two inplace editors.  cancel those and activate again and I get three.
>>  cancel those and activate again and I get four... and on and on and on...
>> >
>> > What's the trick to this?  Here's my code:
>> >
>> > html:
>> > Homer Simpson
>> >
>> > javascript:
>> > function editName(element, id)
>> > {
>> >   new Ajax.InPlaceEditor(element, 'name_inpl_ajax.php', {
>> >   okText: " Save ",
>> >   cancelControl: "button",
>> >   callback: function(form, value) {
>> >   return 'id=' +id + '&name='+encodeURIComponent(value)
>> >   }
>> >   });
>> > }
>> >
>>
>> This editor isn't behaving as documented lately, I had an occasion to
>> upgrade a working editor to the latest versions of Prototype and
>> Scriptaculous, and found that clicking to edit the second time would cause
>> the editor to load the editing form itself for editing. Not a good time for
>> my client!
>>
>> You might want to look at this option:
>>
>> > Removing the behavior
>> > To disable the InPlaceEditor behavior later on, store it in a variable
>> like:
>> >
>> > var editor = new Ajax.InPlaceEditor('product_1'
>> > ,...);
>> >  (...
>> > do
>> >  stuff ..)
>> >  editor.dispose();
>> >
>> > This way, you can enable and disable " In Place Editing ":
>> http://madrobby.github.com/scriptaculous/in-place-editing at will.
>> >
>>
>> See if that can work around the issue for you.
>>
>> Walter
>>
>> --
>> 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.
>> Visit this group at
>> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>  --
> 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.
> Visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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.
Visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Proto-Scripty] scripty inplace editor

2013-01-27 Thread Phil Petree
Yes, multiple instances are being created.

Your stackoverflow solution doesn't work for me.  The elements to be
inplace edited don't exist when the dom is loaded and may not ever exist.

I'm using a tab control, when the tab is activated an ajax call is made and
some html is returned.  In this particular case its a table.

I also have tried this... (unfortunately the available methods are not
clearly documented or rather not documented at all).

function editName(element, id)
{
  if(inpl_desc == null)
  {
inpl_desc = new Ajax.InPlaceEditor(element, 'inpl_ajax.php', {
okText: " Save ",
cancelControl: "button",
rows: 5,
cols: 40,
callback: function(form, value) { return 'id=' +id +
'&desc='+encodeURIComponent(value) },
onEnterEditMode: function(form, value) {
  // custom code goes here...
},
onLeaveEditMode: function(form, value) {
 // custom code goes here...
}
});
  }
  else
inpl_desc.enterEditMode('click');
}

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




Re: [Proto-Scripty] scripty inplace editor

2013-01-28 Thread Phil Petree
Jason,

ended up spending a few hours rewriting some of my code in order to try
your code.  Instead of dom:ready I implemented the inplace editor
onComplete and its working fine.

Still not sure why cancel doesn't actually kill the invocation or why
editor.dispose(); prevents the editor from actually working...

Either way, this implementation is up!

Thanks again!

On Sun, Jan 27, 2013 at 6:51 PM, Jason Westbrook wrote:

>
> So the actual problem is that you are creating multiple inplace editors -
> create it once and let the inplace editor handle the click events
>
> I answered a similar question in more depth on StackOverflow
>
>
> http://stackoverflow.com/questions/14306045/codeigniter-script-aculo-us-inplaceedit-produces-duplicates-on-update/14313622#14313622
>
> Jason Westbrook | T: 313-799-3770 | jwestbr...@gmail.com
>
>
> On Sun, Jan 27, 2013 at 3:24 PM, Phil Petree wrote:
>
>> Thanks Walter.
>>
>> I tried that already and found the editor to be essentially disabled (you
>> could click but not get the form).
>> On Jan 27, 2013 6:14 PM, "Walter Lee Davis"  wrote:
>>
>>>
>>> On Jan 27, 2013, at 4:10 PM, Phil Petree wrote:
>>>
>>> > Hi All!
>>> >
>>> > I'm implementing the scriptaculous inplace editor and I have it
>>> working except for one small detail:
>>> >
>>> > If I activate the editor, click cancel, activate the editor again I
>>> get two inplace editors.  cancel those and activate again and I get three.
>>>  cancel those and activate again and I get four... and on and on and on...
>>> >
>>> > What's the trick to this?  Here's my code:
>>> >
>>> > html:
>>> > Homer Simpson
>>> >
>>> > javascript:
>>> > function editName(element, id)
>>> > {
>>> >   new Ajax.InPlaceEditor(element, 'name_inpl_ajax.php', {
>>> >   okText: " Save ",
>>> >   cancelControl: "button",
>>> >   callback: function(form, value) {
>>> >   return 'id=' +id + '&name='+encodeURIComponent(value)
>>> >   }
>>> >   });
>>> > }
>>> >
>>>
>>> This editor isn't behaving as documented lately, I had an occasion to
>>> upgrade a working editor to the latest versions of Prototype and
>>> Scriptaculous, and found that clicking to edit the second time would cause
>>> the editor to load the editing form itself for editing. Not a good time for
>>> my client!
>>>
>>> You might want to look at this option:
>>>
>>> > Removing the behavior
>>> > To disable the InPlaceEditor behavior later on, store it in a variable
>>> like:
>>> >
>>> > var editor = new Ajax.InPlaceEditor('product_1'
>>> > ,...);
>>> >  (...
>>> > do
>>> >  stuff ..)
>>> >  editor.dispose();
>>> >
>>> > This way, you can enable and disable " In Place Editing ":
>>> http://madrobby.github.com/scriptaculous/in-place-editing at will.
>>> >
>>>
>>> See if that can work around the issue for you.
>>>
>>> Walter
>>>
>>> --
>>> 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.
>>> Visit this group at
>>> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>  --
>> 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.
>> Visit this group at
>> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> 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.
> Visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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.
Visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Proto-Scripty] scripty inplace editor

2013-01-28 Thread Jason Westbrook
No problem - I have a grid of inplaceeditor's running about 60 instances on
one page so it took a few trys to make it work like I needed

Jason Westbrook | T: 313-799-3770 | jwestbr...@gmail.com


On Mon, Jan 28, 2013 at 6:28 AM, Phil Petree  wrote:

> Jason,
>
> ended up spending a few hours rewriting some of my code in order to try
> your code.  Instead of dom:ready I implemented the inplace editor
> onComplete and its working fine.
>
> Still not sure why cancel doesn't actually kill the invocation or why
> editor.dispose(); prevents the editor from actually working...
>
> Either way, this implementation is up!
>
> Thanks again!
>
> On Sun, Jan 27, 2013 at 6:51 PM, Jason Westbrook wrote:
>
>>
>> So the actual problem is that you are creating multiple inplace editors -
>> create it once and let the inplace editor handle the click events
>>
>> I answered a similar question in more depth on StackOverflow
>>
>>
>> http://stackoverflow.com/questions/14306045/codeigniter-script-aculo-us-inplaceedit-produces-duplicates-on-update/14313622#14313622
>>
>> Jason Westbrook | T: 313-799-3770 | jwestbr...@gmail.com
>>
>>
>> On Sun, Jan 27, 2013 at 3:24 PM, Phil Petree wrote:
>>
>>> Thanks Walter.
>>>
>>> I tried that already and found the editor to be essentially disabled
>>> (you could click but not get the form).
>>> On Jan 27, 2013 6:14 PM, "Walter Lee Davis"  wrote:
>>>

 On Jan 27, 2013, at 4:10 PM, Phil Petree wrote:

 > Hi All!
 >
 > I'm implementing the scriptaculous inplace editor and I have it
 working except for one small detail:
 >
 > If I activate the editor, click cancel, activate the editor again I
 get two inplace editors.  cancel those and activate again and I get three.
  cancel those and activate again and I get four... and on and on and on...
 >
 > What's the trick to this?  Here's my code:
 >
 > html:
 > Homer Simpson
 >
 > javascript:
 > function editName(element, id)
 > {
 >   new Ajax.InPlaceEditor(element, 'name_inpl_ajax.php', {
 >   okText: " Save ",
 >   cancelControl: "button",
 >   callback: function(form, value) {
 >   return 'id=' +id + '&name='+encodeURIComponent(value)
 >   }
 >   });
 > }
 >

 This editor isn't behaving as documented lately, I had an occasion to
 upgrade a working editor to the latest versions of Prototype and
 Scriptaculous, and found that clicking to edit the second time would cause
 the editor to load the editing form itself for editing. Not a good time for
 my client!

 You might want to look at this option:

 > Removing the behavior
 > To disable the InPlaceEditor behavior later on, store it in a
 variable like:
 >
 > var editor = new Ajax.InPlaceEditor('product_1'
 > ,...);
 >  (...
 > do
 >  stuff ..)
 >  editor.dispose();
 >
 > This way, you can enable and disable " In Place Editing ":
 http://madrobby.github.com/scriptaculous/in-place-editing at will.
 >

 See if that can work around the issue for you.

 Walter

 --
 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.
 Visit this group at
 http://groups.google.com/group/prototype-scriptaculous?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.


  --
>>> 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.
>>> Visit this group at
>>> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>  --
>> 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.
>> Visit this group at
>> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> 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.
> Visit this group at
> http://groups.google