Variable not replaced/working in Set Safari Field Action

First, some context. I have a series of menus in an online form for setting grades for students, and I want to take a list of grades and iterate through the menus to set each grade. The menus can be identified with identical names except for a number, so I just want to iterate through the menus and assign the respective grade (menu 1 = first grade in list, menu 2 = second, etc.).

The issue comes about in trying to use a variable in the Action that selects the grade. The following works for the first menu:

image

However, if I try to replace the "1" with a variable so that I can iterate through all the menus, such as the following, nothing happens when I "try" the action:

WithVariable

I'm assuming I'm missing a simple detail, but why doesn't the variable work in this context?

The Set field field is a token field, so what you are sowing should be fine, as long as there are no typos or other issues.

Double check the CurrentIteration variable actually has the value you think it does.

Thanks for the quick response and suggestion. To make sure that the variable was typed correctly, I used the "Insert Token" option to insert the variable. In a small test, this seemed to work correctly, since Keyboard Maestro can successfully set the field. However, it seems that the variable is resolved to be '1' no matter what the value of the variable, oddly. For example, with the following two actions, I set the variable and then try to set the respective field based on that variable:

AlwaysSameMenu

Notice that the variable CurrentIteration is already 2 (2 → 2), and the second action should set the current value of the field ("B") to "A". The problem is that the field with id "mgrde_tab2" is "empty", not "B". It's "mgrde_tab1" that is currently "B". Any ideas why "mgrde_tab%Variable%CurrentIteration%" doesn't become "mgrde_tab2" if CurrentIteration = 2?