So I’m working on a simple web app and have run into a speedbump. I’m creating a login containser that has two text fields (one called tfUsername and one called tfPassword). I’ve added the container to a page called pgLoginPage. The original container is called myLoginContainer and the instance of it on the page is called mainLoginContainer.
When the user fills out the login area on the page (which is, as said, contained within the instance of myLoginContainer called mainLoginContainer) I want to check if the tfUsername field is empty or not. I use this code:
if len(tfUsername.Text) = 0 or tfUsernme.Text = “” then
MsgBox(“The username field is empty!”)
tfUsername.Text = “”
tfUsername.SetFocus
end if
When I try to debug the application Xojo throws an error on every mention of tfUsername item doesn’t exist. OK, so I thought maybe I need to tell it that I’m referring to this instance so I added the word self before each reference to the control. So they all look something like:
if len(self.tfUsername.Text) = 0 …
When I use THAT code, I’m told that pageLogin.pageLogin has no member called tfUsername.
I’m lost! How do I actually reference the tfUsername control within this container instance? If I move the code to the Action() event of the actual container (instead of the instance, the same thing happens.
Can anyone help a brother out?