callback

has_many association, nested models and callbacks

Hi! I've got model A and model Attach. I'm editing my A form with nested attributes for :attaches. And when I am deleting all attaches from A via accepts_nested_attributes_for how can I get after_update/after_save callbacks for all of my nested models? Problem is that when I am executing callbacks in model A they are executed right AFTE...

How can i use a duration setting on .animate if it is inside the callback from a .fadeOut effect?

I am trying to just fade the content of section#secondary out and once the content has been faded out, the parent (section#secondary) should animate 'shut' in a slider animation. All this is working however the durations are not and I cannot figure out why. Here is my code: HTML <section id="secondary"> <a href="#" class="slide_b...

Why callbacks for the after_find and after_initialize events is to define them as methods?

The only way to define callbacks for the after_find and after_initialize events is to define them as methods. If you try declaring them as handlers using the second technique, they’ll be silently ignored. Can anybody explain why is it so? Why specifically for these two callbacks? EDIT From the book:-- Rails has to use reflec- tion to...

How do I send a variable in jquery to a callback function? function(r){ }

How do I send a variable in jquery to a callback function? function(r){ } Look at the demo Whilst on the demo, notice that the form above the menu can be serialised. Also notice that when clicking a folder icon whilst on an item (click a category from the left), and submit the form that way, it cannot be serialised. I have a variable ...

JavaScript: How do I use the "callback" function of the "autoload" feature of Google Maps v3

I am using Google Maps v3. I'm currently using the autoload functionality and it's working great: <script type="text/javascript" src='http://www.google.com/jsapi?autoload={modules:[{name:"maps",version:3,other_params:"sensor=false"}]}'&gt;&lt;/script&gt; Now I want to use the autoload to also include the callback option to callback m...

How do I perform a callback on JQuery once it's loaded?

I'm downloading JQuery asynchronously: function addScript(url) { var script = document.createElement('script'); script.src = url; document.getElementsByTagName('head')[0].appendChild(script); } addScript('jquery.js'); // non-jquery code ... // jquery specific code like: $()... As such - how do I call my JQuery specific c...

Javascript AJAX function returns undefined instead of true / false

I have a function that issues an AJAX call (via jQuery). In the complete section I have a function that says: complete: function(XMLHttpRequest, textStatus) { if(textStatus == "success") { return(true); } else { return(false); } } However, if I call this like so: if(callajax()) { // Do som...

Rails accepts_nested_attributes_for callbacks

I have two models Ticket and TicketComment, the TicketComment is a child of Ticket. ticket.rb class Ticket < ActiveRecord::Base has_many :ticket_comments, :dependent => :destroy, :order => 'created_at DESC' # allow the ticket comments to be created from within a ticket form accepts_nested_attributes_for :ticket_comments, :re...

Ajax, Callback, postback and Sys.WebForms.PageRequestManager.getInstance().add_beginRequest

Hi, I have a user control which encapsulates a NumericUpDownExtender. This UserControl implements the interface ICallbackEventHandler, because I want that when a user changes the value of the textbox associated a custom event to be raised in the server. By the other hand each time an async postback is done I shoe a message of loading and...

asp.net mvc equivalent of rails callback before_save

Hi i'm looking for a asp.net mvc callback for elaborate data before save a model. In rails there is before_save. Thanks ...

How do I identify where the POST data sent to a PHP script came from?

I have a ton of data collection forms on my website, and I wrote a PHP script to handle all the data. All the forms have that one script as their action, and POST as the method. The handler emails a copy of the data to me, and I'd like for the emails I get to contain the URL of the form where they originated. Is there any way in PHP t...

Javascript and timing, specifically with callbacks.

I want to make sure I understand callbacks properly, and javascript timing etc. in general. Say my code looks like this, is it gauranteed to execute in order? SetList(); // initilizes the var _list Some.Code(_list, function(data) { // update list }); DoSomething(_list); // operates on _list Update What I am seeing is Se...

Watching a variable for changes without polling.

I'm using a framework called Processing which is basically a Java applet. It has the ability to do key events because Applet can. You can also roll your own callbacks of sorts into the parent. I'm not doing that right now and maybe that's the solution. For now, I'm looking for a more POJO solution. So I wrote some examples to illust...

Using jquery alerts dialog plugin, how do I send a value in a form to a callback feature? The form is in the alert.

Using jquery alerts dialog plugin, how do I send a value in a form that is displayed in an alert, to a callback feature? The form is in the alert, and the callback happens after I click OK. This is code that works, ignore this code as it is a working example, it basically shows how a form can be serialised. This code is taken from the J...

Callback for When jqGrid Finishes Reloading?

Hi, I am using the jqGrid plug-in and at one point I need to refresh the grid and set the selected row to match the record that I am showing in detail on another section of the page. I have the following code but it does not work: $("#AllActions").trigger("reloadGrid").setSelection(selectedRow); The selectedRow parameter comes from an...

Rails: updating an association

I have a Reservation model which belongs_to a Sharedorder and so a Sharedorder has_many reservations. Give you a little background. I sharedorder has many reservations and each reservation can have an amount. A sharedorder has three status: 1) reserved, 2) confirmed, 3) and purchased. Here is my problem. When a reservation gets added ...

Rails callback for the equivalent of "after_new"

Right now I cant find a way to generate a callback between lines 1 and 2 here: f = Foo.new f.some_call f.save! Is there any way to simulate what would be effectively an after_new callback? Right now I'm using after_initialize but there are potential performance problems with using that since it fires for a lot of different events. ...

apple will permit if any third party iphone app will come back to the application after outgoing call end?

Q1. When making an outgoing call in iphone, my app will quit. After call end automatically relaunch my app . Will it be permited by apple? Please help me ASAP.Any help will be accepted. ...

In Android: How to Call Function of Activity from a Service?

Hi folks, I have an Activity (A) and a Service (S) which gets started by A like this: Intent i = new Intent(); i.putExtra("updateInterval", 10); i.setClassName("com.blah", "com.blah.S"); startService(i); A have a function like this one in A: public void someInfoArrived(Info i){...} Now I want to call A.someInfoArrived(i) from with...

Display nice error message when there is something wrong after ajax request jqgrid

Hello, I delete rows with this function: function deleteRow(){ rows = jQuery("#category_grid").getGridParam('selarrrow'); if( rows.length>0){ jQuery('#category_grid').delGridRow(rows,{ msg:'Verwijderen geselecteerde rijen?' }); }else{ alert("Selecteer eerst een rij om te verwijderen!"); } } but when it's fails in my ...