BPak Active Member Licensed User Longtime User Dec 2, 2013 #1 Is there a way of validating a TextField Entry as it is entered from the Keyboard. For example: To only accept Alphabetical input or to only receive numbers or decimal numbers into the Textfield?
Is there a way of validating a TextField Entry as it is entered from the Keyboard. For example: To only accept Alphabetical input or to only receive numbers or decimal numbers into the Textfield?
Erel B4X founder Staff member Licensed User Longtime User Dec 3, 2013 #2 You can handle the TextChanged event and if the text contains a non-numeric character then delete it. Upvote 0
You can handle the TextChanged event and if the text contains a non-numeric character then delete it.
gjoisa Active Member Licensed User Longtime User Dec 6, 2013 #3 Can't we limit it while designing to numeric only or password mode like in B4A ? Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Dec 6, 2013 #4 There isn't an InputType property like in B4A. You can create a Password Field with the scene builder and then treat it as a TextField. Upvote 0
There isn't an InputType property like in B4A. You can create a Password Field with the scene builder and then treat it as a TextField.
BPak Active Member Licensed User Longtime User Dec 6, 2013 #5 Erel said: There isn't an InputType property like in B4A. You can create a Password Field with the scene builder and then treat it as a TextField. Click to expand... Here is what I worked out for Text.. Not perfect but works for me. Sub TrackEd_TextChanged (Old As String, New As String) Dim len As Int Dim chr1 As Char If Old.ToUpperCase = New Then Return ' exits upper case change len = New.Length If len > 0 Then New = New.ToUpperCase For i = 0 To len-1 chr1 = New.CharAt(i) If "ABCDEFGHIJKLMNOPQRSTUVWXYZ".Contains(chr1) = False Then len = Old.Length TrackEd.Text = Old TrackEd.SetSelection(len, len) Return End If Next Else TrackEd.Text = "" Return End If TrackEd.Text = New ' text changed to upper case TrackEd.SetSelection(len, len) End Sub Upvote 0
Erel said: There isn't an InputType property like in B4A. You can create a Password Field with the scene builder and then treat it as a TextField. Click to expand... Here is what I worked out for Text.. Not perfect but works for me. Sub TrackEd_TextChanged (Old As String, New As String) Dim len As Int Dim chr1 As Char If Old.ToUpperCase = New Then Return ' exits upper case change len = New.Length If len > 0 Then New = New.ToUpperCase For i = 0 To len-1 chr1 = New.CharAt(i) If "ABCDEFGHIJKLMNOPQRSTUVWXYZ".Contains(chr1) = False Then len = Old.Length TrackEd.Text = Old TrackEd.SetSelection(len, len) Return End If Next Else TrackEd.Text = "" Return End If TrackEd.Text = New ' text changed to upper case TrackEd.SetSelection(len, len) End Sub