Hi guys,

Man, had to search for ages to find this solution :)

I would add that I couldn't get the proposed solution to work using:
 "onSuccess: function(transport) {
    $('cust_city').value = transport.responseText;
  }, "

After looking up the Prototype site and the Ajax.Request function
here: http://www.prototypejs.org/api/form/element/getValue I had to
adapt the onSuccess function to this:


onSuccess: function(transport) {
                   var frm = $('formname');
                   var room = frm['room'];
                   $(room).value = transport.responseText;}

Small change, but caused a lot of frustration to find.

Cheers,
Ben.

On Mar 25, 6:44 am, Joey H <[EMAIL PROTECTED]> wrote:
> Thanks Guys for the Help... I hope I can return the favor soon!
>
> Joe
>
> On Mar 24, 3:06 pm, "Dan Dorman" <[EMAIL PROTECTED]> wrote:
>
> > On Mon, Mar 24, 2008 at 12:32 PM, Joey H <[EMAIL PROTECTED]> wrote:
> > >  I Would
> > >  like this code to update the value of the cust_city form field...
>
> > >                         var ajax =newAjax.Updater(
> > >                                         {success: 'zipResult'},
> > >                                         url,
> > >                                         {method: 'post', parameters: 
> > > params, onFailure: reportError}
> > >                                 );
>
> > In order to update a form element's value, you'll need to use
> > Ajax.Request, _not_ Ajax.Updater; the latter works on a DOM element's
> > contents, that is, the HTML elements inside another HTML element. The
> > value of a form element, on the other hand, is set via its "value"
> > attribute.
>
> > So something more like this:
>
> >newAjax.Request(url, {
> >   method: 'post',  // not necessary (POST's the default), but I'd use GET
> >   parameters: params,
> >   onSuccess: function(transport) {
> >     $('cust_city').value = transport.responseText;
> >   },
> >   onFailure: reportError
>
> > });
>
> > :Dan
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to