As a NOOB, I am am trying to create a custom alert window where a user will enter API keys for an app integration.
I have created the window, but don’t know, how to get the string which the user enters.
Any help would be most welcome!
Alert Window:
Alert window form code:
class ApiKeyForm(ApiKeyFormTemplate):
def __init__(self, **properties):
# Set Form properties and Data Bindings.
self.init_components(**properties)
# Any code you write here will run before the form opens.
def txtSecretKey_change(self, **event_args):
"""This method is called when the text in this text box is edited"""
secretKey = self.txtSecretKey.text
pass
def txtAccessKey_change(self, **event_args):
"""This method is called when the text in this text box is edited"""
accessKey = self.txtAccessKey.text
pass
from ...ApiKeyForm import ApiKeyForm
result = alert(content=ApiKeyForm(), title="Enter API Key", large=True, buttons=[('OK',{'Secret Key': ApiKeyForm().txtSecretKey.text, 'Access': ApiKeyForm().txtAccessKey.text})])
print(result)
Result I am getting is {‘Secret Key’: ‘’, ‘Access’: ‘’}
If I remove the .text, then the result is
{‘Secret Key’: <anvil.TextBox object>, ‘Access’: <anvil.TextBox object>}