Hello,
I have a issue here. To be short, I will need to do an unbind or
release the bind after form sumbit:
function _add_image() {
var options_submit = {};
options_submit.jqueryaction = "button";
options_submit.id = "submit_button";
options_submit.targets = "result";
options_submit.href = "#";
options_submit.button = true;
jQuery.struts2_jquery.bind(jQuery('#submit_button'),options_submit);
$('#submit_button').click();
};
I did try
jQuery.struts2_jquery.unbind(jQuery('#submit_button'),options_submit);
and $('#submit_button').unbind(submit_button,options_submit); both not
work. So the question is, if there is a way to release the bind or
unbind in sturst2-jquery?
Here is my reason in long. I have a form to sumbit a sale item
listing. I will need the form to be able to load several images of
the item before the listing can be submit. So, have the AJAX showing
the image thumbnails back after each image is uploaded should do the
job. I have above function added to the onchange event of fileupload.
It works, and the first image uploaded correct and the thumbnail shown
up correctly. However, for the second image the code behavious like
the submit button was clicked twice. the the third image load like the
submit button was clicked three times. I believe the reason is that
"bind" got excused each time and caused this problem. To verify this,
I doubled typed the bind code in the above scripts. Then it acted like
the button was clicked twice for the first image load.
So, to resolve this problem, I will need to have a way to unbind or
release the bind right after "$('#submit_button').click();"
Any suggestion would be appreciated.
Joe