[Proto-Scripty] Re: How do I pass other parameters to Autocompleter?

2009-09-14 Thread Alex McAuley

parameters : {
id : myid
}
Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: Paul G pggiff...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Friday, September 11, 2009 11:18 PM
Subject: [Proto-Scripty] How do I pass other parameters to Autocompleter?



 Hi,

  I'm new to all this, both Ajax and Scriptaculous, so please bear
 with my easy question.

  The book Prototype and Scriptaculous in Action gives an example of
 extra query parameters in an Autocompleter as one=1two=2three=3.
 I'd like to pass an extra parameter that's not hard-coded but is a
 variable that is set previously.

  Specifically, I've got two Autocompleter fields.  When the user
 makes a selection in field 1 I capture an id corresponding to the
 selection.  That works fine.  I'd like to pass that id as a query
 parameter in the second field.

  This does not work:

 {
  parameters: 'id='+myid
 }

 How can I pass the id as a query parameter in the 2nd Autocompleter?

 Thanks,

 Paul

 
 


--~--~-~--~~~---~--~~
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: How do I pass other parameters to Autocompleter?

2009-09-14 Thread Alex McAuley

Then you need to do something like

'id='+$('theelement').getValue();

Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: Paul G pggiff...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Monday, September 14, 2009 4:40 PM
Subject: [Proto-Scripty] Re: How do I pass other parameters to 
Autocompleter?



Thanks, but that didn't work.

My autocompleter creation looks like this (in the window.onload
function):

new Ajax.Autocompleter('myField', 'menu', 'myServlet'',
 {
paramName: 'myParam',
parameters: 'type='+1234+'id='+myId
});

The value of myId when the autocompleter is created is what's passed
to the servlet, even if I later change that value.  Likewise if I make
the parameter a function call, e.g.:

parameters: 'type='+1234+'id='+getMyId()

then id is set to whatever getMyId() returns at the time the onload
function is called.

What I want to do is set id to be equal to the value returned from
another Autocompleter on the page (which enables this Autocompleter in
its afterUpdateElement callback), but it appears the parameters are
set when the Autocompleter is created.  It seems like what I want to
do (a succession of Autocompleters allowing a user to drill down
through a hierarchy) should be possible but I'm stuck.

Thanks,

Paul


On Sep 14, 5:44 am, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 parameters : {
 id : myid}

 Alex Mcauleyhttp://www.thevacancymarket.com



 - Original Message -
 From: Paul G pggiff...@gmail.com
 To: Prototype  script.aculo.us 
 prototype-scriptaculous@googlegroups.com
 Sent: Friday, September 11, 2009 11:18 PM
 Subject: [Proto-Scripty] How do I pass other parameters to Autocompleter?

  Hi,

  I'm new to all this, both Ajax and Scriptaculous, so please bear
  with my easy question.

  The book Prototype and Scriptaculous in Action gives an example of
  extra query parameters in an Autocompleter as one=1two=2three=3.
  I'd like to pass an extra parameter that's not hard-coded but is a
  variable that is set previously.

  Specifically, I've got two Autocompleter fields. When the user
  makes a selection in field 1 I capture an id corresponding to the
  selection. That works fine. I'd like to pass that id as a query
  parameter in the second field.

  This does not work:

  {
  parameters: 'id='+myid
  }

  How can I pass the id as a query parameter in the 2nd Autocompleter?

  Thanks,

  Paul- Hide quoted text -

 - Show quoted text -



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---