The first issue I ran into when generating members is that the procedure did not seem to generate correctly. I already did a bug alert on that.
So I wrote the following procedure and it doesn't get called. Can someone tell me how I'm doing this wrong? I want this to execute every time the field loses focus, but when debugging it never seems to trigger.
So I wrote the following procedure and it doesn't get called. Can someone tell me how I'm doing this wrong? I want this to execute every time the field loses focus, but when debugging it never seems to trigger.
B4X:
Dim addTxtSSN As EditText
Sub addTxtSSN_FocusChanged (HasFocus As Boolean)
Dim s As String
Dim myError As Int
If HasFocus = False Then
If addTxtSSN.Text <> "" AND addTxtSSN <> Null Then
myError = 0
s = addTxtSSN.Text
If s.Length <> 11 Then
myError = 1
Else
If IsNumber(s.SubString2(0,0)) = False Then myError = 1
If IsNumber(s.SubString2(1,1)) = False Then myError = 1
If IsNumber(s.SubString2(2,2)) = False Then myError = 1
If s.SubString2(3,3) <> "-" Then myError = 1
If IsNumber(s.SubString2(4,4)) = False Then myError = 1
If IsNumber(s.SubString2(5,5)) = False Then myError = 1
If s.SubString2(6,6) <> "-" Then myError = 1
If IsNumber(s.SubString2(7,7)) = False Then myError = 1
If IsNumber(s.SubString2(8,8)) = False Then myError = 1
If IsNumber(s.SubString2(9,9)) = False Then myError = 1
If IsNumber(s.SubString2(10,10)) = False Then myError = 1
End If
If myError = 1 Then
Msgbox("Invalid SSN format","Invald Format")
addTxtSSN.Text = ""
End If
End If
End If
End Sub