I have run into a problem that I have never created before. I am using the scriptaculous inPlaceEditor If I hit the cancel button, and rehit the editor it then creates two textboxes, and if I repeat three input boxes, etc.! Must be stupid simple, but I AM STUMPED! DECO
Only call the "new Ajax.InPlaceEditor" once per editable field, like when the page first loads. Example: <span id="name_editable">some silly text</span> <script language="text"/javascript">new Ajax.InPlaceEditor(..., 'name_editable', ...);</script> On 2/9/06, Deco Rior <decorior@tennissource.net> wrote:> I have run into a problem that I have never created before. I am > using the scriptaculous inPlaceEditor > > If I hit the cancel button, and rehit the editor it then creates two > textboxes, and if I repeat three input boxes, etc.! > > Must be stupid simple, but I AM STUMPED! > > DECO > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
This should be the case. I am using getElementsbyClassName to get the id''s. Deco On Feb 9, 2006, at 7:09 PM, Ed C. wrote:> Only call the "new Ajax.InPlaceEditor" once per editable field, like > when the page first loads. > > Example: > > <span id="name_editable">some silly text</span> > <script language="text"/javascript">new Ajax.InPlaceEditor(..., > ''name_editable'', ...);</script> > > On 2/9/06, Deco Rior <decorior-w9xKMqPX1QdNhnlO7+U8Og@public.gmane.org> wrote: >> I have run into a problem that I have never created before. I am >> using the scriptaculous inPlaceEditor >> >> If I hit the cancel button, and rehit the editor it then creates two >> textboxes, and if I repeat three input boxes, etc.! >> >> Must be stupid simple, but I AM STUMPED! >> >> DECO >> _______________________________________________ >> Rails-spinoffs mailing list >> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Can you show us your code? On 2/9/06, Deco Rior <decorior@tennissource.net> wrote:> This should be the case. I am using getElementsbyClassName to get the > id's. > > Deco > On Feb 9, 2006, at 7:09 PM, Ed C. wrote: > > > Only call the "new Ajax.InPlaceEditor" once per editable field, like > > when the page first loads. > > > > Example: > > > > <span id="name_editable">some silly text</span> > > <script language="text"/javascript">new Ajax.InPlaceEditor(..., > > 'name_editable', ...);</script> > > > > On 2/9/06, Deco Rior <decorior@tennissource.net> wrote: > >> I have run into a problem that I have never created before. I am > >> using the scriptaculous inPlaceEditor > >> > >> If I hit the cancel button, and rehit the editor it then creates two > >> textboxes, and if I repeat three input boxes, etc.! > >> > >> Must be stupid simple, but I AM STUMPED! > >> > >> DECO > >> _______________________________________________ > >> Rails-spinoffs mailing list > >> Rails-spinoffs@lists.rubyonrails.org > >> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > >> > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Any help is appreciated. The page this is on gets loaded via an ajax
call also
var nid = document.getElementsByClassName("aj_text");
for(i=0;i<nid.length;i++)
{
Event.observe(nid[i].id, ''click'',
function(element,value)
{ getTextBox(this.id,''members'') });
}
function getTextBox(myid,mytab) {
var mylength = ($(myid).innerHTML).length;
if(mylength == 0)mylength=10;
new Ajax.InPlaceEditor($(myid), ''../ajax/textbox.lasso?-
session=tennissource:'' + $F(''sid'') +
''&id='' + $F(''account_name_id'')+
''&page=''+ myid + ''&mytab='' + mytab,
{
rows:1,
size:mylength,
ajaxOptions: {method: ''get''} //override so we can use a
static
for the result
});
}
On Feb 9, 2006, at 7:22 PM, Ed C. wrote:
> Can you show us your code?
>
> On 2/9/06, Deco Rior
<decorior-w9xKMqPX1QdNhnlO7+U8Og@public.gmane.org> wrote:
>> This should be the case. I am using getElementsbyClassName to get the
>> id''s.
>>
>> Deco
>> On Feb 9, 2006, at 7:09 PM, Ed C. wrote:
>>
>>> Only call the "new Ajax.InPlaceEditor" once per editable
field, like
>>> when the page first loads.
>>>
>>> Example:
>>>
>>> <span id="name_editable">some silly
text</span>
>>> <script language="text"/javascript">new
Ajax.InPlaceEditor(...,
>>> ''name_editable'', ...);</script>
>>>
>>> On 2/9/06, Deco Rior
<decorior-w9xKMqPX1QdNhnlO7+U8Og@public.gmane.org> wrote:
>>>> I have run into a problem that I have never created before. I
am
>>>> using the scriptaculous inPlaceEditor
>>>>
>>>> If I hit the cancel button, and rehit the editor it then
creates
>>>> two
>>>> textboxes, and if I repeat three input boxes, etc.!
>>>>
>>>> Must be stupid simple, but I AM STUMPED!
>>>>
>>>> DECO
>>>> _______________________________________________
>>>> Rails-spinoffs mailing list
>>>>
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>>>
>>> _______________________________________________
>>> Rails-spinoffs mailing list
>>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>
>> _______________________________________________
>> Rails-spinoffs mailing list
>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Your problem is that everytime the "aj_text" element is clicked, a new instance of the InPlaceEditor is created. So, 4 clicks = 4 in place editors. You don't want to do it onclick, you want to do it once per element when the page loads. On 2/9/06, Deco Rior <decorior@tennissource.net> wrote:> Any help is appreciated. The page this is on gets loaded via an ajax > call also > > > > var nid = document.getElementsByClassName("aj_text"); > for(i=0;i<nid.length;i++) > { > Event.observe(nid[i].id, 'click', function(element,value) > { getTextBox(this.id,'members') }); > } > > function getTextBox(myid,mytab) { > var mylength = ($(myid).innerHTML).length; > if(mylength == 0)mylength=10; > new Ajax.InPlaceEditor($(myid), '../ajax/textbox.lasso?- > session=tennissource:' + $F('sid') + '&id=' + $F('account_name_id')+ > '&page='+ myid + '&mytab=' + mytab, { > rows:1, > size:mylength, > ajaxOptions: {method: 'get'} //override so we can use a static > for the result > }); > > } > > On Feb 9, 2006, at 7:22 PM, Ed C. wrote: > > > Can you show us your code? > > > > On 2/9/06, Deco Rior <decorior@tennissource.net> wrote: > >> This should be the case. I am using getElementsbyClassName to get the > >> id's. > >> > >> Deco > >> On Feb 9, 2006, at 7:09 PM, Ed C. wrote: > >> > >>> Only call the "new Ajax.InPlaceEditor" once per editable field, like > >>> when the page first loads. > >>> > >>> Example: > >>> > >>> <span id="name_editable">some silly text</span> > >>> <script language="text"/javascript">new Ajax.InPlaceEditor(..., > >>> 'name_editable', ...);</script> > >>> > >>> On 2/9/06, Deco Rior <decorior@tennissource.net> wrote: > >>>> I have run into a problem that I have never created before. I am > >>>> using the scriptaculous inPlaceEditor > >>>> > >>>> If I hit the cancel button, and rehit the editor it then creates > >>>> two > >>>> textboxes, and if I repeat three input boxes, etc.! > >>>> > >>>> Must be stupid simple, but I AM STUMPED! > >>>> > >>>> DECO > >>>> _______________________________________________ > >>>> Rails-spinoffs mailing list > >>>> Rails-spinoffs@lists.rubyonrails.org > >>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > >>>> > >>> _______________________________________________ > >>> Rails-spinoffs mailing list > >>> Rails-spinoffs@lists.rubyonrails.org > >>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > >> > >> _______________________________________________ > >> Rails-spinoffs mailing list > >> Rails-spinoffs@lists.rubyonrails.org > >> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > >> > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Haha! Boy, I must have set this up a hundred times, and was totally spacing it! In an effort to make more compressed code I totally missed it :-) Thanks, Deco On Feb 9, 2006, at 9:52 PM, Ed C. wrote:> Your problem is that everytime the "aj_text" element is clicked, a new > instance of the InPlaceEditor is created. So, 4 clicks = 4 in place > editors. > > You don''t want to do it onclick, you want to do it once per element > when the page loads. > > On 2/9/06, Deco Rior <decorior-w9xKMqPX1QdNhnlO7+U8Og@public.gmane.org> wrote: >> Any help is appreciated. The page this is on gets loaded via an ajax >> call also >> >> >> >> var nid = document.getElementsByClassName("aj_text"); >> for(i=0;i<nid.length;i++) >> { >> Event.observe(nid[i].id, ''click'', function(element,value) >> { getTextBox(this.id,''members'') }); >> } >> >> function getTextBox(myid,mytab) { >> var mylength = ($(myid).innerHTML).length; >> if(mylength == 0)mylength=10; >> new Ajax.InPlaceEditor($(myid), ''../ajax/textbox.lasso?- >> session=tennissource:'' + $F(''sid'') + ''&id='' + $F(''account_name_id'')+ >> ''&page=''+ myid + ''&mytab='' + mytab, { >> rows:1, >> size:mylength, >> ajaxOptions: {method: ''get''} //override so we can use a static >> for the result >> }); >> >> } >> >> On Feb 9, 2006, at 7:22 PM, Ed C. wrote: >> >>> Can you show us your code? >>> >>> On 2/9/06, Deco Rior <decorior-w9xKMqPX1QdNhnlO7+U8Og@public.gmane.org> wrote: >>>> This should be the case. I am using getElementsbyClassName to >>>> get the >>>> id''s. >>>> >>>> Deco >>>> On Feb 9, 2006, at 7:09 PM, Ed C. wrote: >>>> >>>>> Only call the "new Ajax.InPlaceEditor" once per editable field, >>>>> like >>>>> when the page first loads. >>>>> >>>>> Example: >>>>> >>>>> <span id="name_editable">some silly text</span> >>>>> <script language="text"/javascript">new Ajax.InPlaceEditor(..., >>>>> ''name_editable'', ...);</script> >>>>> >>>>> On 2/9/06, Deco Rior <decorior-w9xKMqPX1QdNhnlO7+U8Og@public.gmane.org> wrote: >>>>>> I have run into a problem that I have never created before. I am >>>>>> using the scriptaculous inPlaceEditor >>>>>> >>>>>> If I hit the cancel button, and rehit the editor it then creates >>>>>> two >>>>>> textboxes, and if I repeat three input boxes, etc.! >>>>>> >>>>>> Must be stupid simple, but I AM STUMPED! >>>>>> >>>>>> DECO >>>>>> _______________________________________________ >>>>>> Rails-spinoffs mailing list >>>>>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >>>>>> >>>>> _______________________________________________ >>>>> Rails-spinoffs mailing list >>>>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >>>> >>>> _______________________________________________ >>>> Rails-spinoffs mailing list >>>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >>>> >>> _______________________________________________ >>> Rails-spinoffs mailing list >>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> >> _______________________________________________ >> Rails-spinoffs mailing list >> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs