jrFormSubmit();

nate
@nate
11 years ago
917 posts
Is there a way to create a custom handler for the return of the jrFormSubmit function?

I need to get the ajax response to do some animation and stuff.
updated by @nate: 02/27/14 02:59:59AM
michael
@michael
11 years ago
7,800 posts
Looks like it currently returns true/false on submit. Sounds like your after an event/listener type setup for it.

Is there a 'normal' way to listen for a function end without altering the code of the main function?
nate
@nate
11 years ago
917 posts
I was thinking, as long as the module (index.php) gives an ajax repose it should work. No?
michael
@michael
11 years ago
7,800 posts
I don't think so. I think your going to need to get it via js.

my understanding:
* page submits form via ajax and jrFormSubmit
* the POST info goes of to a url for processing.
* that url sends back some json info that the jrFormSubmit is waiting for
* jrFormSubmit finishes up its processing and hides the spinner and does whatever else it wants to.
* (you want to do stuff here on that same page.)

If you try to pick it up via the server side events/listeners its going to be on the processing side of things. a different url so your not going to be able to trigger javascript stuff on the page that sent the info.

The first thing that jumps to mind is:
jrFormSubmit(.....)

change to 
if(jrFormSubmit){
// do this other stuff
}

but that requires changes to the tpl files. So better than that if possible is to listen for jrFormSubmit finishing then do your stuff.

I'm just not sure how thats normally done in js though.

--- edit --
yeah index.php will send back a response, but its jrFormSubmit that is waiting for that response. Not sure if there is a way for another function to pick up on that returning response or not.
updated by @michael: 01/22/14 07:09:41PM

Tags