[Proto-Scripty] Re: Ajax.Updater - Sending form.serialize + other variables

2009-09-04 Thread Daniel Rubin

Senthil Krishnamoorthy wrote:
 Actually I want to pass form parameter as well as other my defined
 parameters to the Ajax.Updater.  How do i do that.  Basically
 Ajax.Updater is recognizing the either form.serialize or {} hash
 parameters.
 
 Anybody help me out how to pass the both in parameters option.
Hi Senthil,

there's an option hash [1] to Form.serialize () which -- when set to
true -- returns a {}-Object that can be passed as params to
Ajax.Updater.  Get that and alter it to suit your needs.

[1] http://api.prototypejs.org/dom/form.html#serialize-class_method

Have fun
Daniel



 regards,
 Senthil Krishnamoorthy


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



[Proto-Scripty] Re: Ajax.Updater - Sending form.serialize + other variables

2009-09-04 Thread T.J. Crowder

E.g.:

var data = $('myform').serialize(true);
data.more = stuff;
new Ajax.Updater(id, url, {
parameters: data
});
--
T.J. Crowder
tj / crowder software / com
www.crowdersoftware.com

On Sep 4, 4:56 pm, Daniel Rubin dru...@dimedis.de wrote:
 Senthil Krishnamoorthy wrote:
  Actually I want to pass form parameter as well as other my defined
  parameters to the Ajax.Updater.  How do i do that.  Basically
  Ajax.Updater is recognizing the either form.serialize or {} hash
  parameters.

  Anybody help me out how to pass the both in parameters option.

 Hi Senthil,

 there's an option hash [1] to Form.serialize () which -- when set to
 true -- returns a {}-Object that can be passed as params to
 Ajax.Updater.  Get that and alter it to suit your needs.

 [1]http://api.prototypejs.org/dom/form.html#serialize-class_method

 Have fun
 Daniel



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



[Proto-Scripty] Re: Ajax.Updater - Sending form.serialize + other variables

2009-02-14 Thread Ralph

Hello,

I have used the hints you've posted before and I can add new keys with
values to my hash (thanks very much for that), but it doesn't
serialize my formelements:

function updateOrder(orderID)
{
var formhash = $('form'+orderID).serialize(true);
formhash.orderID = orderID;

new Ajax.Request('modules/orders/updateorder.php',
{
method: 'post',
parameters: formhash,
...

Firebug tells me that only my orderID is transmitted via post,
is it a problem that the form is created previous by Ajax? (form id
is correct)

thanks for helping,
Ralph

On 31 Jan., 11:40, coruscant ca...@two-wings.net wrote:
 Ok, I got it to run now. Thank you very much for your help. I guess
 your last post is worth to be added to the documentation of
 form.serialize, I think it could help other people to save some time.

 Best Regards,
 Benedikt.

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



[Proto-Scripty] Re: Ajax.Updater - Sending form.serialize + other variables

2009-02-14 Thread Ralph

Hello,

I tried the same and adding new key with values worked very good,
thanks.
I've got another problem, my form won't send data. Only orderID is
transmitted via post. (all id-attributtes are set)

function updateOrder(orderID)
{
var formhash = $('form'+orderID).serialize(true);
formhash.orderID = orderID;

new Ajax.Request('modules/orders/updateorder.php',
{
method: 'post',
parameters: formhash,
...

is it a problem that my form is created asynchronous?

Thanks for your help,
Ralph

On 31 Jan., 11:40, coruscant ca...@two-wings.net wrote:
 Ok, I got it to run now. Thank you very much for your help. I guess
 your last post is worth to be added to the documentation of
 form.serialize, I think it could help other people to save some time.

 Best Regards,
 Benedikt.

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



[Proto-Scripty] Re: Ajax.Updater - Sending form.serialize + other variables

2009-02-14 Thread T.J. Crowder

Hi,

Have you inspected formhash in Firefox to make sure that it contains
other fields?  That code should work fine.  Do your form fields have
names (not just ids)?

Complete working example; the server side (not given) just echoes the
parameters in an HTML fragment:
http://pastie.org/389054

HTH,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


On Feb 13, 4:09 pm, Ralph ralph.pavensta...@gmail.com wrote:
 Hello,

 I tried the same and adding new key with values worked very good,
 thanks.
 I've got another problem, my form won't send data. Only orderID is
 transmitted via post. (all id-attributtes are set)

 function updateOrder(orderID)
 {
         var formhash = $('form'+orderID).serialize(true);
         formhash.orderID = orderID;

         new Ajax.Request('modules/orders/updateorder.php',
         {
                 method: 'post',
                 parameters:     formhash,
 ...

 is it a problem that my form is created asynchronous?

 Thanks for your help,
 Ralph

 On 31 Jan., 11:40, coruscant ca...@two-wings.net wrote:

  Ok, I got it to run now. Thank you very much for your help. I guess
  your last post is worth to be added to the documentation of
  form.serialize, I think it could help other people to save some time.

  Best Regards,
  Benedikt.


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



[Proto-Scripty] Re: Ajax.Updater - Sending form.serialize + other variables

2009-02-14 Thread Ralph

Hello again,

thanks, my input fields had no name attribute, now it works!

sorry for doubleposting.

Best Regards,
Ralph

On 14 Feb., 12:16, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 Have you inspected formhash in Firefox to make sure that it contains
 other fields?  That code should work fine.  Do your form fields have
 names (not just ids)?

 Complete working example; the server side (not given) just echoes the
 parameters in an HTML fragment:http://pastie.org/389054

 HTH,
 --
 T.J. Crowder
 tj / crowder software / com
 Independent Software Engineer, consulting services available

 On Feb 13, 4:09 pm, Ralph ralph.pavensta...@gmail.com wrote:

  Hello,

  I tried the same and adding new key with values worked very good,
  thanks.
  I've got another problem, my form won't send data. Only orderID is
  transmitted via post. (all id-attributtes are set)

  function updateOrder(orderID)
  {
          var formhash = $('form'+orderID).serialize(true);
          formhash.orderID = orderID;

          new Ajax.Request('modules/orders/updateorder.php',
          {
                  method: 'post',
                  parameters:     formhash,
  ...

  is it a problem that my form is created asynchronous?

  Thanks for your help,
  Ralph

  On 31 Jan., 11:40, coruscant ca...@two-wings.net wrote:

   Ok, I got it to run now. Thank you very much for your help. I guess
   your last post is worth to be added to the documentation of
   form.serialize, I think it could help other people to save some time.

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



[Proto-Scripty] Re: Ajax.Updater - Sending form.serialize + other variables

2009-01-31 Thread coruscant

Ok, I got it to run now. Thank you very much for your help. I guess
your last post is worth to be added to the documentation of
form.serialize, I think it could help other people to save some time.

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



[Proto-Scripty] Re: Ajax.Updater - Sending form.serialize + other variables

2009-01-23 Thread T.J. Crowder

Hi,

Form#serialize[1] returns a Hash object[2] when you call it with
'true' as the getHash parameter (as you are).  So just do that
*before* your Ajax.Updater call, and add your further items to the
Hash, and then pass the Hash into the updater call.

[1] http://prototypejs.org/api/form/serialize
[2] http://prototypejs.org/api/hash

HTH,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


On Jan 23, 8:53 am, coruscant ca...@two-wings.net wrote:
 Hello All,

 I want to use Ajax.updater in one of my PHP scripts. I would like to
 send all the variables of a form to the server, therefore I use the
 form serialize method. Anyway I need to tell the server other
 variables that are not and can not be in the form. Is it somehow
 possible to do this?

 I tried things like:

 new Ajax.Updater('rettab', '$script', {
   method: 'post',
   parameters: $('thisform').serialize(true), {variable1: 'input',
 variable2: 'otherinput', variable3: 'somestring'},
   evalScripts: 'true'
   });

 Also this way does not work:

 new Ajax.Updater('rettab', '$script', {
   method: 'post',
   parameters: {$('thisform').serialize(true), variable1: 'input',
 variable2: 'otherinput', variable3: 'somestring'},
   evalScripts: 'true'
   });

 And this way doesn't work either:

 new Ajax.Updater('rettab', '$script', {
   method: 'post',
   parameters: $('thisform').serialize(true),
   parameters: {variable1: 'input', variable2: 'otherinput', variable3:
 'somestring'},
   evalScripts: 'true'
   });

 Does anybody have an idea?

 Thanks in advance.

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



[Proto-Scripty] Re: Ajax.Updater - Sending form.serialize + other variables

2009-01-23 Thread coruscant

Hi,

thank you for your reply.

I tried to incorporate this in my script which is now looking like
this:

var formhash = $('myform').serialize();

formhash.set('key1', 'value1');
formhash.set('key2', 'value2');
formhash.set('key3', 'value3');

new Ajax.Updater(rettab, '$script', {
  method: 'post',
  parameters: formhash.map,
  evalScripts: 'true'
  });

Anyway I get the return error:
formhash.set is not a function

Can you please tell me what I am doing wrong?

Thanks again,
Benedikt.


On 23 Jan., 10:00, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 Form#serialize[1] returns a Hash object[2] when you call it with
 'true' as the getHash parameter (as you are).  So just do that
 *before* your Ajax.Updater call, and add your further items to the
 Hash, and then pass the Hash into the updater call.

 [1]http://prototypejs.org/api/form/serialize
 [2]http://prototypejs.org/api/hash

 HTH,
 --
 T.J. Crowder
 tj / crowder software / com
 Independent Software Engineer, consulting services available

 On Jan 23, 8:53 am, coruscant ca...@two-wings.net wrote:

  Hello All,

  I want to use Ajax.updater in one of my PHP scripts. I would like to
  send all the variables of a form to the server, therefore I use the
  form serialize method. Anyway I need to tell the server other
  variables that are not and can not be in the form. Is it somehow
  possible to do this?

  I tried things like:

  new Ajax.Updater('rettab', '$script', {
    method: 'post',
    parameters: $('thisform').serialize(true), {variable1: 'input',
  variable2: 'otherinput', variable3: 'somestring'},
    evalScripts: 'true'
    });

  Also this way does not work:

  new Ajax.Updater('rettab', '$script', {
    method: 'post',
    parameters: {$('thisform').serialize(true), variable1: 'input',
  variable2: 'otherinput', variable3: 'somestring'},
    evalScripts: 'true'
    });

  And this way doesn't work either:

  new Ajax.Updater('rettab', '$script', {
    method: 'post',
    parameters: $('thisform').serialize(true),
    parameters: {variable1: 'input', variable2: 'otherinput', variable3:
  'somestring'},
    evalScripts: 'true'
    });

  Does anybody have an idea?

  Thanks in advance.

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



[Proto-Scripty] Re: Ajax.Updater - Sending form.serialize + other variables

2009-01-23 Thread coruscant

Hi,

thanks, this was a silly mistake. I corrected it to:

var formhash = $('myform').serialize(true);

Anyway the error message is still the same:

formhash.set is not a function

I am using prototype 1.6. I also get the error when trying not to do
the Form#serialize thing but rather call a new hash with

var formhash = new hash();

I really have no clue what I should try next.

Best Regards,
Benedikt.



On 23 Jan., 12:44, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 You need to pass 'true' to serialize() to get a hash rather than a
 string.  See the Form#serialize docs referenced earlier for details.

 HTH,
 --
 T.J. Crowder
 tj / crowder software / com
 Independent Software Engineer, consulting services available

 On Jan 23, 10:28 am, coruscant ca...@two-wings.net wrote:

  Hi,

  thank you for your reply.

  I tried to incorporate this in my script which is now looking like
  this:

  var formhash = $('myform').serialize();

  formhash.set('key1', 'value1');
  formhash.set('key2', 'value2');
  formhash.set('key3', 'value3');

  new Ajax.Updater(rettab, '$script', {
    method: 'post',
    parameters: formhash.map,
    evalScripts: 'true'
    });

  Anyway I get the return error:
  formhash.set is not a function

  Can you please tell me what I am doing wrong?

  Thanks again,
  Benedikt.

  On 23 Jan., 10:00, T.J. Crowder t...@crowdersoftware.com wrote:

   Hi,

   Form#serialize[1] returns a Hash object[2] when you call it with
   'true' as the getHash parameter (as you are).  So just do that
   *before* your Ajax.Updater call, and add your further items to the
   Hash, and then pass the Hash into the updater call.

   [1]http://prototypejs.org/api/form/serialize
   [2]http://prototypejs.org/api/hash

   HTH,
   --
   T.J. Crowder
   tj / crowder software / com
   Independent Software Engineer, consulting services available

   On Jan 23, 8:53 am, coruscant ca...@two-wings.net wrote:

Hello All,

I want to use Ajax.updater in one of my PHP scripts. I would like to
send all the variables of a form to the server, therefore I use the
form serialize method. Anyway I need to tell the server other
variables that are not and can not be in the form. Is it somehow
possible to do this?

I tried things like:

new Ajax.Updater('rettab', '$script', {
  method: 'post',
  parameters: $('thisform').serialize(true), {variable1: 'input',
variable2: 'otherinput', variable3: 'somestring'},
  evalScripts: 'true'
  });

Also this way does not work:

new Ajax.Updater('rettab', '$script', {
  method: 'post',
  parameters: {$('thisform').serialize(true), variable1: 'input',
variable2: 'otherinput', variable3: 'somestring'},
  evalScripts: 'true'
  });

And this way doesn't work either:

new Ajax.Updater('rettab', '$script', {
  method: 'post',
  parameters: $('thisform').serialize(true),
  parameters: {variable1: 'input', variable2: 'otherinput', variable3:
'somestring'},
  evalScripts: 'true'
  });

Does anybody have an idea?

Thanks in advance.

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



[Proto-Scripty] Re: Ajax.Updater - Sending form.serialize + other variables

2009-01-23 Thread T.J. Crowder

Hi,

Whenever you're faced with this sort of thing, your best bet is to use
a debugger and inspect what you're really getting back, perhaps even
using it to walk through the Prototype code to see what's going on,
read through the Prototype code you're using, etc.  Doing that can be
a very fast way of figuring out what's going on.  Some debugging
resources can be found here:
http://proto-scripty.wikidot.com/resources

In this case, looking at the Prototype code, it looks to me like the
documentation is a bit misleading:  It says serialize will return a
hash, and it does in the lower-case general sense of the word.  It
doesn't return a Hash object.  Sorry about that!

So what you get back is a POJO (plain old JavaScript object), which is
(IMHO) even better, because then you can do this:

var formhash = $('myform').serialize(true);

formhash.key1 = 'value1'; // Or formhash['key1'] = 'value1'; if you
like
formhash.key2 = 'value2';
formhash.key3 = 'value3';

When you're passing the object into the updater, just pass it
directly.

HTH,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


On Jan 23, 12:05 pm, coruscant ca...@two-wings.net wrote:
 Hi,

 thanks, this was a silly mistake. I corrected it to:

 var formhash = $('myform').serialize(true);

 Anyway the error message is still the same:

 formhash.set is not a function

 I am using prototype 1.6. I also get the error when trying not to do
 the Form#serialize thing but rather call a new hash with

 var formhash = new hash();

 I really have no clue what I should try next.

 Best Regards,
 Benedikt.

 On 23 Jan., 12:44, T.J. Crowder t...@crowdersoftware.com wrote:

  Hi,

  You need to pass 'true' to serialize() to get a hash rather than a
  string.  See the Form#serialize docs referenced earlier for details.

  HTH,
  --
  T.J. Crowder
  tj / crowder software / com
  Independent Software Engineer, consulting services available

  On Jan 23, 10:28 am, coruscant ca...@two-wings.net wrote:

   Hi,

   thank you for your reply.

   I tried to incorporate this in my script which is now looking like
   this:

   var formhash = $('myform').serialize();

   formhash.set('key1', 'value1');
   formhash.set('key2', 'value2');
   formhash.set('key3', 'value3');

   new Ajax.Updater(rettab, '$script', {
     method: 'post',
     parameters: formhash.map,
     evalScripts: 'true'
     });

   Anyway I get the return error:
   formhash.set is not a function

   Can you please tell me what I am doing wrong?

   Thanks again,
   Benedikt.

   On 23 Jan., 10:00, T.J. Crowder t...@crowdersoftware.com wrote:

Hi,

Form#serialize[1] returns a Hash object[2] when you call it with
'true' as the getHash parameter (as you are).  So just do that
*before* your Ajax.Updater call, and add your further items to the
Hash, and then pass the Hash into the updater call.

[1]http://prototypejs.org/api/form/serialize
[2]http://prototypejs.org/api/hash

HTH,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available

On Jan 23, 8:53 am, coruscant ca...@two-wings.net wrote:

 Hello All,

 I want to use Ajax.updater in one of my PHP scripts. I would like to
 send all the variables of a form to the server, therefore I use the
 form serialize method. Anyway I need to tell the server other
 variables that are not and can not be in the form. Is it somehow
 possible to do this?

 I tried things like:

 new Ajax.Updater('rettab', '$script', {
   method: 'post',
   parameters: $('thisform').serialize(true), {variable1: 'input',
 variable2: 'otherinput', variable3: 'somestring'},
   evalScripts: 'true'
   });

 Also this way does not work:

 new Ajax.Updater('rettab', '$script', {
   method: 'post',
   parameters: {$('thisform').serialize(true), variable1: 'input',
 variable2: 'otherinput', variable3: 'somestring'},
   evalScripts: 'true'
   });

 And this way doesn't work either:

 new Ajax.Updater('rettab', '$script', {
   method: 'post',
   parameters: $('thisform').serialize(true),
   parameters: {variable1: 'input', variable2: 'otherinput', variable3:
 'somestring'},
   evalScripts: 'true'
   });

 Does anybody have an idea?

 Thanks in advance.

 Benedikt.


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