iOS Question B4XInputTemplate - why OK enabled with nonmatching regex?

Andris

Active Member
Licensed User
Longtime User
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:
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:
B4XInputTemplate1.png


When I start typing input:
B4XInputTemplate2.png


When I complete YES input:
B4XInputTemplate3.png


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).
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
This is a bug. It is related to the buttons being made of labels. It is fixed in v2.24.

 
Upvote 0
Top