Thanks TJ, "$($('eventform').oid).setValue(li.id);" worked great along
with
changing the "parameter" line in auto3 to "parameters: "uidx=" + $($
('eventform').oid).value,"

My OReilly Ajax book warned me about the *ID* vs. *NAME* issues but
thanks for that tip also.
Onward and Upward...

On Jul 24, 4:02 am, "T.J. Crowder" <[email protected]> wrote:
> Hi,
>
> If `$('eventform').oid` is the *ID* of a form field, then you get the
> element via `$($('eventform').oid)`. To set a form field's value, you
> don't use `update`, you use `setValue`. So:
>
> $($('eventform').oid).setValue(li.id);
>
> I emphasized *ID* above because `$` looks things up by ID, not by
> name. So you need to use the `id` attribute on the field's element,
> not `name`. From the property name, I'm guessing that's what you're
> doing, but if you're using `name` instead, that's also easy: You'd use
> Element#down on the form element with an attribute selector:
>
> var form = $('eventform');
> form.down("[name=" + form.oid + "]").setValue(li.id);
>
> References:http://api.prototypejs.org/dom/form/element/setvalue/http://api.prototypejs.org/dom/element/down/
> --
> T.J. Crowder
> Independent Software Consultant
> tj / crowder software / comwww.crowdersoftware.com
>
> On Jul 23, 8:55 pm, ChrisH <[email protected]> wrote:
>
> > The second form "$(id).update("<p>Hi there</p>"); seems most
> > appropriate, but my element is a form field, oid of the element $
> > ('eventform').  Firebug shows me that it hasn't processed an update
> > because it sends my default value of $('eventform').oid to the
> > server.  So I think the $(id) part is the problem: how to address $
> > ('eventform').oid as an element?
>
> > On Jul 23, 2:16 pm, "T.J. Crowder" <[email protected]> wrote:
>
> > > Hi,
>
> > > `update` isn't a global symbol, you either need `Element.update` or an
> > > element instance on which you call `.update`, e.g.:
>
> > >     var id = "foo";
>
> > >     Element.update(id, "<p>Hi there</p>");
> > >     // -or-
> > >     $(id).update("<p>Hi there</p>");
>
> > > (In the latter case, it doesn't have to be looked up by ID, as long as
> > > you eventually get an extended instance of an element. Could be $$
> > > ('td.foo')[0] or any other way of getting a specific instance.)
>
> > > More here:http://api.prototypejs.org/dom/element/update/
>
> > > Unless you mean Ajax.Updater, which does an Ajax call and then calls
> > > #update behind the scenes, which is something totally 
> > > different:http://api.prototypejs.org/ajax/ajax/updater/
>
> > > I'm afraid I don't immediately understand what the line in question
> > > does, so I can't give an edited example of it. But hopefully the above
> > > helps figure it out.
>
> > > HTH,
> > > --
> > > T.J. Crowder
> > > Independent Software Consultant
> > > tj / crowder software / comwww.crowdersoftware.com
>
> > > On Jul 23, 7:22 pm, ChrisH <[email protected]> wrote:
>
> > > > I am trying to get a short list of supervisors into a form based on a
> > > > selection "off_name" in an Autocompleter, also in that form.
> > > > The code below worked until I added the getOfficerData() function,
> > > > passing an index value returned in the <li> as li.id.
> > > > I started getting "update not defined" errors in Firebug
> > > > with the update($('eventform').oid.value, li.id);" line cited.  $
> > > > ('eventform').oid is a hidden text field in the form, used just to
> > > > hold
> > > > the returned index for the selection.
>
> > > > Any ideas on where I've gone wrong? I know I need to dynamically set
> > > > the returned value so the second Autocompleter can pass it back in the
> > > > next request.
>
> > > >                 var auto2 = new Ajax.Autocompleter("off_name", 
> > > > "off_name_choices",
> > > > "username_response_generator.jsp",
> > > >                         {
> > > >                                 //tokens: ',',
> > > >                                 paramName: "value",
> > > >                                 minChars: 2,
> > > >                                 indicator: "autocompleter_indicator2",
> > > >                                 afterUpdateElement: getOffSelectionId});
> > > >                 var auto3 = new Ajax.Autocompleter("supvname", 
> > > > "supvname_choices",
> > > > "supervisor_response_generator.jsp",
> > > >                         {
> > > >                                 paramName: "value",
> > > >                                 minChars: 1,
> > > >                                 indicator: "autocompleter_indicator3",
> > > >                                 parameters: "uidx=" + 
> > > > $('eventform').oid.value,
> > > >                                 afterUpdateElement: 
> > > > getSupvSelectionId});
>
> > > >                 function getOffSelectionId(text, li) {
> > > >                 holdArray[0] = li.id;
> > > >                 update($('eventform').oid.value, li.id);
> > > >                 //getOfficerData();
> > > >                 return holdArray;
> > > >                 }
>
>

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to