Delayed event bubbling...

Delayed event bubbling...

I need to delay the bubbly of a live event until i have the result of a different function that is called.

What I have is a large form which has incremental saves, these have their own Save button which has a live click event attached to them.

Theres also sections of the form where you can create additional fields. For example you can add multiple locations, so it add's another address section with its own Save button.

One of the section however, has an upload control, which is in an iframe. The button attached has an "UploadFile()" function on the click event.

The UploadFile is called before the live event which is good.

However i need to delay the call of the live event until i get the result back in the UploadFile function. The uploadfile function basically tells the iframe to submit the form with the file, and retrieves the filename back, passes it into a hidden field ready for that section to send its data to the server using $.post().

So i need to wait until i get that filename before it calls the live event.

I could break off the live event into its own function so that the live event just calls that function, then on the upload file, call do what i need to do, call that function and cancel the event bubbling. But i want to know if its possible to delay it until i have a result so i don't have to change the live event.

Hope that all makes sense.
    • Topic Participants

    • blog