Hello, thank you all for previous help, now I''ve got a new interesting problem. some text that is to be edited is HTML type text, which is escaped when the server generates the page. So, it needs to be unescaped for editing. Sounds simple for prototypes unescapeHTML method. But I can''t seem to get a handle on the forms input element. I''ve been working with the onEnterEditMode callback but this seems to be firing just before the <form><input> is created in the DOM. I''ve considered the loadTextURL as a possible solution, but that seems like unnecessary server traffic. Thank You --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Checkout the onFormCustomization custom callback event, it looks like it should work for your needs. new Ajax.InPlaceEditor( ''some-id'', ''some-url'', { onFormCustomization:function(ipe, ipeForm){ ipe._controls.editor.value = ''something special''; } } ); I''ve never personally used it, instead favoring loadTextURL, but it seems like it should work for your needs. -justin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I did try the onFormCustomization, however it behaved the same way. but I did skin this cat, here''s my solution... onEnterEditMode:function(x){ setTimeout(function(){ var h = $(form_id).descendants().first(); h.value = h.value.unescapeHTML(); }, 1); } It seems a bit hackish, but the setTimeout function works so fast that the switch is almost imperceptible. if there is a cleaner solution please let me know, but I''m going with this for now... On Jan 15, 3:33 pm, "Justin Perkins" <justinperk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Checkout the onFormCustomization custom callback event, it looks like > it should work for your needs. > > new Ajax.InPlaceEditor( ''some-id'', ''some-url'', { > onFormCustomization:function(ipe, ipeForm){ ipe._controls.editor.value > = ''something special''; } } ); > > I''ve never personally used it, instead favoring loadTextURL, but it > seems like it should work for your needs. > > -justin--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Jan 15, 2008 5:45 PM, Andy Koch <andy.koch-sBIqA0PYact54TAoqtyWWQ@public.gmane.org> wrote:> > I did try the onFormCustomization, however it behaved the same way.What version of Scriptaculous are you using (see your scriptaculous.js file). You should be using 1.8.0 or higher. I tested onFormCustomization shortly after I sent the previous email and it worked as expected. You *do not* want to use onEnterEditMode with a timeout. onEnterEditMode is fired *before* the form and it''s controls are created, so your timeout is just luckily working for you, but that doesn''t mean it will work all the time. onFormCustomization was created for your exact needs, it should work fine. If not, then use loadTextURL. Here is an example usage, which works (I tested it): <span id="customize-me">Spicy Pepper</span> <script type="text/javascript">new Ajax.InPlaceEditor( ''customize-me'', ''/some/url'', { onFormCustomization: function( ipe, ipeForm){ ipe._controls.editor.value = "Spicy Pepper" } } );</script> -justin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks Justin, that does work perfectly, I changed after reading your dire warning. I didn''t know about the "._controls.editor" bit, of course now they all say "spicy pepper"... I''ll just tell ''em it''s a feature ;-) On Jan 15, 3:54 pm, "Justin Perkins" <justinperk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jan 15, 2008 5:45 PM, Andy Koch <andy.k...-sBIqA0PYact54TAoqtyWWQ@public.gmane.org> wrote: > > > > > I did try the onFormCustomization, however it behaved the same way. > > What version of Scriptaculous are you using (see your scriptaculous.js > file). You should be using 1.8.0 or higher. > > I tested onFormCustomization shortly after I sent the previous email > and it worked as expected. > > You *do not* want to use onEnterEditMode with a timeout. > onEnterEditMode is fired *before* the form and it''s controls are > created, so your timeout is just luckily working for you, but that > doesn''t mean it will work all the time. > > onFormCustomization was created for your exact needs, it should work > fine. If not, then use loadTextURL. > > Here is an example usage, which works (I tested it): > > <span id="customize-me">Spicy Pepper</span> > <script type="text/javascript">new Ajax.InPlaceEditor( ''customize-me'', > ''/some/url'', { onFormCustomization: function( ipe, ipeForm){ > ipe._controls.editor.value = "Spicy Pepper" } } );</script> > > -justin--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Glad it worked out. I didn''t really mean it to be dire, but I guess it''s OK that it was interpreted as such :) -justin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---