run loop only one time
hello, i use this on Text field :
event.value = event.value.replace(/\,AbAb/g, "1234");
program check if AbAb and replace it with 1234
how to run only one time this loop? and if i write again AbAb the keep AbAb ??
hello, i use this on Text field :
event.value = event.value.replace(/\,AbAb/g, "1234");
program check if AbAb and replace it with 1234
how to run only one time this loop? and if i write again AbAb the keep AbAb ??
hi subieguy2 this answer work for 1 field...
i have 5 text fields and i want to restart this loop for every new field... for now on text field 1 work but when i go to text field 2 not work because check has value 1.
Ok so if you want the loop to run more times then change the length like this....
var check = 0;
if (check < 4){
event.value = event.value.replace(/\,AbAb/g, "1234");
check++;
}
Or depending on how and where you are running this from do like Bernd Alheit said and check multiples like this...
var checkFieldOne = 0;
var checkFieldTwo = 0;
var checkFieldThree = 0;
var checkFieldFour = 0;
var checkFieldFive = 0;
if (checkFieldOne == 0){
event.value = event.value.replace(/\,AbAb/g, "1234");
checkFieldOne++;
}
if (checkFieldTwo == 0){
event.value = event.value.replace(/\,AbAb/g, "1234");
checkFieldTwo++;
}
if (checkFieldThree == 0){
event.value = event.value.replace(/\,AbAb/g, "1234");
checkFieldThree++;
}
if (checkFieldFour == 0){
event.value = event.value.replace(/\,AbAb/g, "1234");
checkFieldFour++;
}
if (checkFieldFive == 0){
event.value = event.value.replace(/\,AbAb/g, "1234");
checkFieldFive++;
}
If this doesn't get you what you are looking for I would suggest posting more details about your document and how you want it to be used. Or better yet share a file and we can help try to get your questions answered.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.