Re: Other parameters on InPlaceEditor

a.alonzi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Tue, 10 Jul 2007 15:25:51 -0000

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