[Facebooker-talk] FBJS, Ajax, Select box, Dialog

Alan Larkin
2009-01-07T10:51:01Z

Im thinking that this might be less wrong.

<fb:js-string var="successCallback">
   new Dialog().showMessage(''Dialog'', ''Ok'');
   return false;
</fb:js-string>

<%= select_tag :player, options_for_select(...),
     :onchange => "Ajax.Request(this.getValue(), { onSuccess:
successCallback
});" %>

because I dont think the variables and functions in my original onSuccess code
were being subjected to FBJS renaming. I am _guessing_ that using fb:js-string
to prepare the code takes care of this, but there is still nothing happening in
response to a successful Ajax request.

Alan Larkin wrote:
> So I have been at this all day. I am trying to trigger an Ajax request
> and subsequent dialog popup in response to a change in a Select box.
> Heres what Ive got:
>
> <%= select_tag :player, options_for_select(...),
>     :onchange => "Ajax.Request(this.getValue(),
>       { onSuccess: \"new
Dialog().showMessage(''Dialog'', ''Ok''); return
> false;\" });" %>
>
> (the values of the select items are URLs)
>
> The logs show the query runs and returns successfully, but I cannot get
> anything to happen beyond that. There is nothing in the JS error console.