What I’m trying to do:
Loop through List of field names in my form to evaluate their text attributes
What I’ve tried and what’s not working:
I’m able to loop through the List and construct Strings representing the objects and the attributes I’m after, but I can’t actually evaluate these String representations. I get the error:
AttributeError: ‘str’ object has no attribute ‘text’
And since it appears that the eval() function isn’t supported, I can’t figure out how to pull in this info. In the code below, the error comes on the line: “thisFieldValue=thisFieldInput.text”
Code Sample:
def validator(self):
fieldTextList=['camperfirstname','camperlastname','parentname','parentemail','parentphone']
for f in range(len(fieldTextList)):
thisFieldInput='self.text_'+fieldTextList[f]
thisFieldValue=thisFieldInput.text
print (thisFieldInput)
print (thisFieldValue)
Thank you.