a.alonzi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jul-10 13:17 UTC
Other parameters on InPlaceEditor
Hi to all, I have a doubt on like passing other URL parameters to InPlaceEditor function. For Ajax.Updater I can use "parameters:", but for InPlaceEditor (or InPlaceCollectionEditor) I cannot use "parameters". How I make to pass other parameters to the page that callback? A sample code: ---------------------------------- var editor= new Ajax.InPlaceCollectionEditor(el, url, { ajaxOptions: {method: ''get''}, value: ($(el).innerHTML==''Yes'') ? ''1'' : ''0'', collection: [[0,''No''],[1,''Yes]], parameters: ''op=pag_sca&id='' + id_pagam + ''&id_cliente=<?=$id_user?>&id_order=<?=$_REQUEST[''id'']?>'',onBlur: function(request) {Element.show(''indicator'')} }); ---------------------------------- 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 -~----------~----~----~----~------~----~------~--~---
Hey, Use the callback option, which works like Ajax.Autocompleter''s: you specify a function of yours that will take two arguments: the form element created for IPE and the editable field''s value. It''s in charge of returning the serialized parameters. The default implementation just does: callback: function(form) { return Form.serialize(form); } You can use that to bind in your own stuff, like: callback: function(form, value) { var data = Form.serialize(form, true); data.merge({ myParam1: value1, myParam2, value2 /*...*/ }); return data.toQueryString(); } Or if you''re more into serialized forms already (which means you take care of URL-encoding yourself, ugh): callback: function(form, value) { return Form.serialize(form) + ''myParam1=value1&myParam2=value2''; } (Obviously here, we don''t URl-encode anything, but you may need to). ''HTH -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
a.alonzi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jul-10 15:25 UTC
Re: Other parameters on InPlaceEditor
Hi Christophe, thank you :-) I have another doubt. I have used the callback, but it does not come passed no parameter the InPlaceEditor function isn''t into a form. Can I use the same one the one which you have advised to me? the code is: ---------------------------------------------------- var editor= new Ajax.InPlaceCollectionEditor(el, url, { ajaxOptions: {method: ''get''}, value: ($(el).innerHTML==''Yes'') ? ''1'' : ''0'', collection: [[0,''No''],[1,''Yes'']], callback: function(form, value) { return ''op=pag_sca&id='' + id_pagam + ''&id_cliente=<?=$id_user?>&id_order=<?=$_REQUEST[''id'']?>''}, onBlur: function(request) {Element.show(''indicator'')} }); ---------------------------------------------------- Thank you, Antonello On 10 Lug, 16:43, Christophe Porteneuve <t...-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> wrote:> Hey, > > Use the callback option, which works like Ajax.Autocompleter''s: you > specify a function of yours that will take two arguments: the form > element created for IPE and the editable field''s value. It''s in charge > of returning the serialized parameters. The default implementation just > does: > > callback: function(form) { return Form.serialize(form); } > > You can use that to bind in your own stuff, like: > > callback: function(form, value) { > var data = Form.serialize(form, true); > data.merge({ myParam1: value1, myParam2, value2 /*...*/ }); > return data.toQueryString(); > } > > Or if you''re more into serialized forms already (which means you take > care of URL-encoding yourself, ugh): > > callback: function(form, value) { > return Form.serialize(form) + ''myParam1=value1&myParam2=value2''; > } > > (Obviously here, we don''t URl-encode anything, but you may need to). > > ''HTH > > -- > Christophe Porteneuve aka TDD > t...-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
a.alonzi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org a écrit :> I have used the callback, but it does not come passed no parameterHow do you know? Your code doesn''t use them...> the InPlaceEditor function isn''t into a form.Indeed. The form is created dynamically at runtime by IPE when you start editing. -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
a.alonzi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jul-11 07:31 UTC
Re: Other parameters on InPlaceEditor
> > > I have used the callback, but it does not come passed no parameter > > How do you know? Your code doesn''t use them...Are you sure? How to I must change the code? the code is: ---------------------------------------------------- var editor= new Ajax.InPlaceCollectionEditor(el, url, { ajaxOptions: {method: ''get''}, value: ($(el).innerHTML==''Yes'') ? ''1'' : ''0'', collection: [[0,''No''],[1,''Yes'']], callback: function(form, value) { return ''op=pag_sca&id='' + id_pagam + ''&id_cliente=<?=$id_user?>&id_order=<?=$_REQUEST[''id'']?>''}, onBlur: function(request) {Element.show(''indicator'')} }); ---------------------------------------------------- I have used: ------------------------------------------- callback: function(form, value) { return ''op=pag_sca&id='' + id_pagam + ''&id_cliente=<?=$id_user?>&id_order=<?=$_REQUEST[''id'']?>''}, ------------------------------------------- perhaps it is not corrected?> > > the InPlaceEditor function isn''t into a form. > > Indeed. The form is created dynamically at runtime by IPE when you > start editing.mmm... ok :-) Thank you very much --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
a.alonzi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jul-11 07:43 UTC
Re: Other parameters on InPlaceEditor
It''s possible that the callbak run into Ajax.InPlaceEditor but not into Ajax.InPlaceCollectionEditor ? I Have These two function write in same mode, but only for Ajax.InPlaceCollectionEditor I cannot see the other parameter passed by callback Thank''s --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hey, a.alonzi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org a écrit :> It''s possible that the callbak run into > Ajax.InPlaceEditor > but not into > Ajax.InPlaceCollectionEditor > ?Is your callback function even called on an IPCE? Source code indicates that it''s overridden internally, thus your version should never be used! -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hey, a.alonzi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org a écrit :> callback: function(form, value) { return ''op=pag_sca&id='' + id_pagam > + ''&id_cliente=<?=$id_user?>&id_order=<?=$_REQUEST[''id'']?>''},Where in that function do you use either form or value? The names of the arguments in your URL are too confuse for me to make sense out of it anyway, but what I can say is: the string you''re returning here is fairly fixed. Where does this id_pagam var come from? Something in the outer scopes? Here''s a rewrite that would add a "value" parameter with the form''s value, and URL-encode any text value, if necessary, as it goes: callback: function(form, value) { var params = { op: ''pag_sca'', id: id_pagam, id_cliente: ''<?= $id_user ?>'', id_order: ''<?= $_REQUEST[''id''] ?>'', value: value }; return Hash.toQueryString(params); } -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
a.alonzi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jul-11 08:02 UTC
Re: Other parameters on InPlaceEditor
Hi to all, I have find a solutions. At the end of URL http://wiki.script.aculo.us/scriptaculous/show/Ajax.In+Place+Collection+Editor there is a small piece of JS code to add a scriptaculous to enable callback for InPlaceCollectionEditor Thank you very much Christophe, because with your suggest I have find a solutions. I think that Thomas Fuchs must include these code directly into scriptaculous code. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hey, a.alonzi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org a écrit :> I think that Thomas Fuchs must include these code directly into > scriptaculous code.IPE/IPCE have been completely rewritten, from scratch, with an eye towards efficiency, consistency, API cleanup and new features. The rewrite is being written dozens of tests against, and when we''re happy with the testing, we''ll put that in trunk. -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Possibly Parallel Threads
- InPlace[Collection]Editor rewrite: it's in trunk!
- how-to pass other values to InPlaceCollectionEditor?
- Can't change paramName with InPlaceCollectionEditor
- Ajax.InPlaceEditor via PHP via prototype widows class = HELP :-)
- [PATCH] Allow Ajax.InPlaceCollectionEditor to load collection externally