I don't see your test code above in the example and I'm not sure what your trying to do.
It would seem you could just use the onload event to do all those things without iterating through the controls using got focus.
TempVars!Genus = "Acacia"
TempVars!Species = "binervia"...