How to enforce "12:30" time formatting in Web Input

I’m trying to create a DateTime picker using WebDatePicker and some form of “Time Picker”. I’m using a WebCombobox to display a customary list of times, but want the user to be able to overwrite the value with a time of their own. What is the easiest way to validate user entry, restrict it to “numbers only” and preferably also shove the “:” seperator in there too?

To have something like this (may change depending on the browser):
image

you may be able to use some ExecuteJavaScript to change the type=“text” to type=“time”

On Button I have MessageBox(TextField2.Text) and this is the result:
image

Note: with Chrome (what I tested) you can use the arrows (up/down) or type the time you want.

I will open a Feature Request to add type Time to Xojo.

Thanks Alberto, you may have inadvertently given me an immediate solution - break the time into HH and MM fields and enforce their input independently.

1 Like

I hate inputs like that with a PASSION. :grimacing:

I think OP is looking for how to restrict a text field to valid characters, which I would do (have done in Web 1.0) with JavaScript and RegEx. This is something that should be on the browser side to be responsive to the user, but also needs to be checked server side to ensure the user didn’t circumvent the JavaScript.