I am seraching a match in a string by using search function, say like below JS……say, 1st result is found,well…….2nd is found, well….3rd id not found, then the control/cursor is coming out of the loop, i mean, right away the loop is terminating, i thought the ELSE condition is gonnna trigger and continues the iteration until the end of the length…but in the middle its terminating! Pls. suggest me either fix or provide a new JS, Thank you
// OriginalFields is a string, its fillled with fields list with space seperator
myArrayGrey = greyFields.split(" ");
for (var i = 0; i < myArrayGrey.length; i++) {
var returnValue = OriginalFields.search(myArrayGrey[i]);
if (returnValue != -1) {
//grey the field
// and
// make access = "readOnly";
};
else {;
// do nothing
// just for my testing am doing app.alert (not found)
};
};
The most probable answer, since your OP does not include much details, is because
myArrayGrey = greyFields.split(" ");returns an empty array.