A Antonio Ferreira Member Licensed User Longtime User Dec 27, 2024 #1 How can i validate a numeric minimum value in a EditText on a xcustomlistview (with lazy loading) Validating the maximum value is easy with EditText_Textchanged event. Thanks
How can i validate a numeric minimum value in a EditText on a xcustomlistview (with lazy loading) Validating the maximum value is easy with EditText_Textchanged event. Thanks
LucaMs Expert Licensed User Longtime User Dec 27, 2024 #2 Antonio Ferreira said: How can i validate a numeric minimum value in a EditText on a xcustomlistview (with lazy loading) Validating the maximum value is easy with EditText_Textchanged event. Thanks Click to expand... Same way! Upvote 0
Antonio Ferreira said: How can i validate a numeric minimum value in a EditText on a xcustomlistview (with lazy loading) Validating the maximum value is easy with EditText_Textchanged event. Thanks Click to expand... Same way!
A Antonio Ferreira Member Licensed User Longtime User Dec 27, 2024 #3 LucaMs said: Same way! Click to expand... I have a minimum value of 50 and I want to write 72, in the first digit I write (7), the editText changevent warns me that the value is less than the minimum. Thanks for the reply Upvote 0
LucaMs said: Same way! Click to expand... I have a minimum value of 50 and I want to write 72, in the first digit I write (7), the editText changevent warns me that the value is less than the minimum. Thanks for the reply
LucaMs Expert Licensed User Longtime User Dec 27, 2024 #4 But this does not depend on the EditText being inside a CustomListview. B4X: 'Not tested Private Sub EditText1_TextChanged (Old As String, New As String) If New.Length > 1 And New.As(Int) < 50 Then xui.MsgboxAsync("At least 50", "B4X") EditText1.Text = Old End If End Sub Upvote 0
But this does not depend on the EditText being inside a CustomListview. B4X: 'Not tested Private Sub EditText1_TextChanged (Old As String, New As String) If New.Length > 1 And New.As(Int) < 50 Then xui.MsgboxAsync("At least 50", "B4X") EditText1.Text = Old End If End Sub
A Antonio Ferreira Member Licensed User Longtime User Dec 27, 2024 #5 LucaMs said: But this does not depend on the EditText being inside a CustomListview. B4X: 'Not tested Private EditText1_TextChanged (Old As String, New As String) If New.Length > 1 And New.As(Int) < 50 Then xui.MsgboxAsync("At least 50", "B4X") EditText1.Text = Old End If End Sub Click to expand... Validate the minimum value with EditText1_TextChanged (Old As String, New As String) i always have the warns that the value is less than the minimum. in your example: - if ! want to write 272 in the editText, when i write the second digit (27) the EditText1_TextChanged event warns me that the value is less than the minimum. - if i only write 2 in the editText i don´t have the validate error message. Validate with EditText1_FocusChanged on in a xcustomlistview with lazy loading is not simple. it's not worrying. i just have to live with it Thank you for the reply. Upvote 0
LucaMs said: But this does not depend on the EditText being inside a CustomListview. B4X: 'Not tested Private EditText1_TextChanged (Old As String, New As String) If New.Length > 1 And New.As(Int) < 50 Then xui.MsgboxAsync("At least 50", "B4X") EditText1.Text = Old End If End Sub Click to expand... Validate the minimum value with EditText1_TextChanged (Old As String, New As String) i always have the warns that the value is less than the minimum. in your example: - if ! want to write 272 in the editText, when i write the second digit (27) the EditText1_TextChanged event warns me that the value is less than the minimum. - if i only write 2 in the editText i don´t have the validate error message. Validate with EditText1_FocusChanged on in a xcustomlistview with lazy loading is not simple. it's not worrying. i just have to live with it Thank you for the reply.
LucaMs Expert Licensed User Longtime User Dec 27, 2024 #6 Antonio Ferreira said: Validate the minimum value with EditText1_TextChanged (Old As String, New As String) i always have the warns that the value is less than the minimum. in your example: - if ! want to write 272 in the editText, when i write the second digit (27) the EditText1_TextChanged event warns me that the value is less than the minimum. - if i only write 2 in the editText i don´t have the validate error message. Validate with EditText1_FocusChanged on in a xcustomlistview with lazy loading is not simple. it's not worrying. i just have to live with it Thank you for the reply. Click to expand... My code avoids the problem you highlighted, with the single digit example. It is clear that you cannot use the Changed event in other cases, like the one you wrote above. You will need to add a button to submit changes. Again, the CustomListView has nothing to do with the problem. Upvote 0
Antonio Ferreira said: Validate the minimum value with EditText1_TextChanged (Old As String, New As String) i always have the warns that the value is less than the minimum. in your example: - if ! want to write 272 in the editText, when i write the second digit (27) the EditText1_TextChanged event warns me that the value is less than the minimum. - if i only write 2 in the editText i don´t have the validate error message. Validate with EditText1_FocusChanged on in a xcustomlistview with lazy loading is not simple. it's not worrying. i just have to live with it Thank you for the reply. Click to expand... My code avoids the problem you highlighted, with the single digit example. It is clear that you cannot use the Changed event in other cases, like the one you wrote above. You will need to add a button to submit changes. Again, the CustomListView has nothing to do with the problem.
E emexes Expert Licensed User Longtime User Dec 27, 2024 #7 Antonio Ferreira said: i just have to live with it Click to expand... What about if you do the limit check when the user "leaves" the field ie on FocusChange or LostFocus event? Admittedly, isn't quite as instantaneous at letting user know there is a problem. On the other hand, isn't stepping on their fingers prematurely either. Upvote 0
Antonio Ferreira said: i just have to live with it Click to expand... What about if you do the limit check when the user "leaves" the field ie on FocusChange or LostFocus event? Admittedly, isn't quite as instantaneous at letting user know there is a problem. On the other hand, isn't stepping on their fingers prematurely either.
Sagenut Expert Licensed User Longtime User Dec 27, 2024 #8 Here I made the check to happen after 1 second without writing into the edittext. So there is time to input more than 1 digit. Attachments ETMinMax.zip ETMinMax.zip 14.1 KB · Views: 295 Upvote 0
Here I made the check to happen after 1 second without writing into the edittext. So there is time to input more than 1 digit.
A Antonio Ferreira Member Licensed User Longtime User Dec 27, 2024 #9 Sagenut said: Here I made the check to happen after 1 second without writing into the edittext. So there is time to input more than 1 digit. Click to expand... Thanks for the solution with a timer on the TextChanged event Works great Upvote 0
Sagenut said: Here I made the check to happen after 1 second without writing into the edittext. So there is time to input more than 1 digit. Click to expand... Thanks for the solution with a timer on the TextChanged event Works great