on 2019 Jul 16 2:47 PM
Hi,
I have a MessageBox in my for loop. There are two buttons (yes and No) inside messageBox. I am expecting the loop control to wait until user action from the MessageBox buttons. Would it be possible. I know MessageBox is asynchronous. I am looking for an alternative.
Example:
var array = [file1, file2, file3];
for(var i = 0; i < array.length; i++){
if(array[i] === "file1"){
MessageBox.confirm("File exists already. Do you want to Replace or Create?", { actions: ["Yes", "No"],
onClose: function (sAction) {
if (sAction === "Yes") {
//Make a call to backend
//
} else {
//Make a call to backend
} }});
}
I have to validate for each element in the array. Whenever matches found, Messagebox appears and user has to select the buttons inside it. But loop control won't stops for user event from MessageBox. Can we use nested callbacks in this case?
Thanks in advance.
Regards
Karthik S
Request clarification before answering.
Hi,
I think this might help.
Check this link I found thru google: StackOverflow - JS Closure inside loops.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
69 | |
16 | |
10 | |
7 | |
7 | |
4 | |
4 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.