Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt to use function to call processing rather than upload immediately after choosing file(s) #36

Open
VitoAsaro opened this issue Mar 11, 2014 · 4 comments

Comments

@VitoAsaro
Copy link

First of all, thanks for this function; it's excellent!
I've been trying to implement this as part of another function, so I'm not using it as part of the jquery document ready:

$(document).ready(function(){
$('input[type="file"]').ajaxfileupload({
'action': 'uploadfile.cfm'
});

I'm attempting to call it from another function that is called by a button on my form:
<input type="button" name="btnAction" id="btnAction" value="UPDATE RECORD" onClick="recordAddUpdate(this.form);" >

within the function recordAddUpdate(theForm) to call the ajaxfileupload I have:
...
$('#uploadImage').ajaxfileupload({
'action': 'bsl-editor/bslupload.cfm',
'submit_button': $('#btnAction')
});
...

This works, but only after the "UPDATE RECORD" button is pressed twice
I see in your javascript that the first time the function processes, nothing occurs because it's processing the "ajaxUploader-setup" as true and initializing.
How can I have it both set up (initialize) and process with only a single call to the function?

Thanks!!

@jfeldstein
Copy link
Owner

Try calling .change() on the file input or initializing the ajax upload
before the user chooses the file

~ J

(via phone)
On Mar 10, 2014 6:07 PM, "VitoAsaro" [email protected] wrote:

First of all, thanks for this function; it's excellent!
I've been trying to implement this as part of another function, so I'm not
using it as part of the jquery document ready:

$(document).ready(function(){
$('input[type="file"]').ajaxfileupload({
'action': 'uploadfile.cfm'
});

I'm attempting to call it from another function that is called by a button
on my form:

within the function recordAddUpdate(theForm) to call the ajaxfileupload I
have:
...
$('#uploadImage').ajaxfileupload({
'action': 'bsl-editor/bslupload.cfm',
'submit_button': $('#btnAction')
});
...

This works, but only after the "UPDATE RECORD" button is pressed twice
I see in your javascript that the first time the function processes,
nothing occurs because it's processing the "ajaxUploader-setup" as true and
initializing.
How can I have it both initialze and process with only a single call to
the function?

Thanks!!

Reply to this email directly or view it on GitHubhttps://github.com//issues/36
.

@VitoAsaro
Copy link
Author

I tried to initialize the ajax upload in the $(document).ready(function), but I think that perhaps because the form resides within a dialog (modal) window, possibly the DOM changes, so the initializing has to occur all over again when the dialog window is showing.

I was able to find a work-around by specifying the submit button used to process the form (calls the data processing proxy function) with:
'submit_button': $('#btnAction')
However, the strang thing is that if I didn't specifiy the onComplete AND the onStart functions, nothing would work, even though the onStart function is empty. Any ideas?

@jfeldstein
Copy link
Owner

If this is still an issue, could you post the code your using and I'll take
a look?
On Mar 11, 2014 11:05 AM, "VitoAsaro" [email protected] wrote:

I tried to initialize the ajax upload in the $(document).ready(function),
but I think that perhaps because the form resides within a dialog (modal)
window, possibly the DOM changes, so the initializing has to occur all over
again when the dialog window is showing.

I was able to find a work-around by specifying the submit button used to
process the form (calls the data processing proxy function) with:
'submit_button': $('#btnAction')
However, the strang thing is that if I didn't specifiy the onComplete AND
the onStart functions, nothing would work, even though the onStart function
is empty. Any ideas?

Reply to this email directly or view it on GitHubhttps://github.com//issues/36#issuecomment-37328811
.

@mirszhao
Copy link

you can use the item 'submit_button':$("#iconsu"),// bind a button click event

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants