Forum: Ruby on Rails Ajax makes me cry

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
John R. (Guest)
on 2006-01-04 04:42
What is the difference in treatment between an ajax link_to_remote and a
form_remote_tag

This works great and adds a list item to an ordered list with
id=form_results

link_to_remote ("Help me please!",
                :update => 'form_results',
                :url   => { :action => :search_ajax_test },
                :position => 'bottom')

with this log message

Processing AdminController#search_ajax_test (for 192.168.15.100 at
2006-01-03 21:35:43) [POST]
  Parameters: {"action"=>"search_ajax_test", "controller"=>"admin"}
Completed in 0.00079 (1272 reqs/sec) | DB: 0.00000 (0%) | 200 OK
[http://192.168.15.50/admin/search_ajax_test]

This does absolutely nothing at all

form_remote_tag ( :udpate => 'form_results',
                  :url    =>  { :action => :search_ajax_test },
                  :position => 'bottom')
...some stuff...
end_form_tag

but still produces this log message

Processing AdminController#search_ajax_test (for 192.168.15.100 at
2006-01-03 21:35:46) [POST]
  Parameters: {"commit"=>"Search", "action"=>"search_ajax_test",
"controller"=>"admin", "query"=>"asdf"}
Completed in 0.00077 (1291 reqs/sec) | DB: 0.00000 (0%) | 200 OK
[http://192.168.15.50/admin/search_ajax_test]


Can anyone tell me why the form call does nothing at all?

Thanks
Vivek K. (Guest)
on 2006-01-04 06:07
(Received via mailing list)
On 1/4/06, John R. <removed_email_address@domain.invalid> wrote:
>
> What is the difference in treatment between an ajax link_to_remote and a
> form_remote_tag

The former generates a <a> tag and the latter generates a <form> which
sends
post data asynchronously after serializing it in url encoded
form.Bothreturn html which is inserted into the html noe whose id is
in :update


> but still produces this log message
>
> Thanks


It would be better  if you post the generated html because the code in
your
view looks ok.Besides are actually returning any html in your controller
action? is there a call to a render ?  Whatever is returned by render
will
be inserted into the 'form_results' node.
Vivek


--
Ben H. (Guest)
on 2006-01-04 06:25
John R. wrote:

> form_remote_tag ( :udpate => 'form_results',
> Thanks

update, not udpate, lol.
John R. (Guest)
on 2006-01-04 14:07
Ben H. wrote:

>> form_remote_tag ( :udpate => 'form_results',
>> Thanks
>
> update, not udpate, lol.

AAAAAAAAAAAHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

You are my hero.  Thank you so much.
John R. (Guest)
on 2006-01-04 14:51
John R. wrote:
> Ben H. wrote:
>
>>> form_remote_tag ( :udpate => 'form_results',
>>> Thanks
>>
>> update, not udpate, lol.
>
> AAAAAAAAAAAHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>
> You are my hero.  Thank you so much.

After calming down a little bit, shouldn't this have thrown some kind of
error? What good is a *remote call with no update ( or udpate )
assigned.  Is there a way to turn on strict checking or something?
Anything more helpful than apparent success?  Thanks again.
Thomas F. (Guest)
on 2006-01-04 15:01
(Received via mailing list)
For two situations:

1) for .rjs templates, you don't do :update
2) if you handle the data return somehow yourself, with a :complete
=> '...' JavaScript callback

-Thomas

Am 04.01.2006 um 13:51 schrieb John R.:
Vivek K. (Guest)
on 2006-01-04 19:13
(Received via mailing list)
On 1/4/06, John R. <removed_email_address@domain.invalid> wrote:
>
> Ben H. wrote:
>
> >> form_remote_tag ( :udpate => 'form_results',
> >> Thanks
> >
> > update, not udpate, lol.
>
> AAAAAAAAAAAHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


ooops..missed that!!  this uses the named parameter syntax of ruby and
not
the hash  way of passing params..so it should give an error..or probably
ruby ignores it ?
This topic is locked and can not be replied to.