2SucresCelestin
Member
I m just trying to make a register layer and still impossible due to EditText.Text always considered as empty, even when the user writes in the EditText :/ . I didn t find any thread about that...
I m a beginner on B4A so the issue can be a stupid mistake
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
			
			I m a beginner on B4A so the issue can be a stupid mistake
			
				layer's code:
			
		
		
		#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
End Sub
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Private txtEmail As EditText
    Private txtPassword As EditText
    Private txtAddress As EditText
    Private btnRegister As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    Activity.LoadLayout("layRegister")
   
    'Initialize elements
    txtEmail.Initialize("Email")
    txtPassword.Initialize("Password")
    txtAddress.Initialize("Address")
   
    btnRegister.Initialize("Register")
End Sub
Sub Activity_Resume
   
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Private Sub btnRegister_Click
   
    If txtEmail.Text = "" Then
        MsgboxAsync("Email cannot be empty","")
        Return
    End If
   
    'Limit the data you want from the file (SQLite) by using a cursor
    Dim rs As ResultSet
    rs = Starter.sql.ExecQuery("SELECT user_name FROM User WHERE user_name='"& txtEmail.Text &"'")
   
    MsgboxAsync("", txtEmail.Text)
   
    If rs.RowCount > 0 Then
        MsgboxAsync("Email already used", "Failed")
    End If
    If rs.RowCount == 0 Then
        Starter.sql.ExecNonQuery("INSERT INTO User (user_name, user_password, user_address) VALUES ('"&  txtEmail.Text  &"' , '"& txtPassword.Text &"', '"& txtAddress.Text &"')")
        MsgboxAsync("Record saved", "Successed")
    End If
   
    rs.Position = 0
    rs.Close
   
End Sub
Private Sub txtEmail_TextChanged (Old As String, New As String)
    txtEmail.Text = New
    Log("hey")
End Sub 
				 
 
		 
			 
 
		 
 
		 
						
					 
 
		