How to process a set of Buttons using a variable in the Button ID?


#1

To process a set of Forms, one can use ChangeForm(window["Form" & i]).

I want to do the same thing with a long set of (about 50) buttons all located in a single Form… that is, to do a simple routine on each button sequentially in a DO — WHILE loop (or the equivalent) by just changing " i ".

I’ve tried some different structures to do this, but so far, none work… Continue to get error message saying that can’t, e.g., change background color of an undefined object.

The work-around is to code each button separately.

Tom

PS: Running latest version of AppStudio, Windows 10, Chrome, LG Android, iPad Mini.


#2

Try this:

NSB.$("Button" & i).style.background="red"


#3

…style.background=“red” does NOT work… must be …“backgroundColor”… (The word ‘Color’ was missing…)

Beautiful… Thanks!..

Tom