I've been converting some code to B4X and am wondering why B4XInputTemplate allows me to proceed out of the dialog even if the regex is not a match, and even if I've entered nothing at all in the text box. Here's my code:
Here's the dialog when it first appears:
When I start typing input:
When I complete YES input:
The color of the OK button appears to indicate that it is disabled in the first two images, as I would expect it to. And when I enter the full text of YES in the last image, OK becomes illuminated, which I would expect to mean valid input, an enabled OK button, and a closing of the dialog upon clicking it.
However, OK is enabled in all three cases, closing the dialog and displaying the entered text as the result. Is this the way it is supposed to work? If so, what's the use of providing regex if validation has to be incorporated later, after closing the dialog? Is this a bug? I have the latest version of B4i (6.30).
B4XInputTemplate code snippet ...:
dialog.Initialize(Page1.RootPanel)
Dim input As B4XInputTemplate
input.Initialize
input.lblTitle.Text="Enter YES to confirm ..."
input.RegexPattern = "^YES$"
Wait For (dialog.ShowTemplate(input, "OK", "", "CANCEL")) Complete (Result As Int)
If Result = mbx.DialogResponse_Positive Then
dialog.Show(input.Text, "OK", "", "")
End If
Here's the dialog when it first appears:
When I start typing input:
When I complete YES input:
The color of the OK button appears to indicate that it is disabled in the first two images, as I would expect it to. And when I enter the full text of YES in the last image, OK becomes illuminated, which I would expect to mean valid input, an enabled OK button, and a closing of the dialog upon clicking it.
However, OK is enabled in all three cases, closing the dialog and displaying the entered text as the result. Is this the way it is supposed to work? If so, what's the use of providing regex if validation has to be incorporated later, after closing the dialog? Is this a bug? I have the latest version of B4i (6.30).