« Trip to New York and … | Home | Congratulations to th… »

Tip of the day: Step for Textfield in Xojo

Today a client asked if we could change the step count for number fields in a Xojo web app. As the HTML Input element offers a step feature, we could easily implement the step and also offer a min and max values, too. For example you can put this lines in an Open or Shown event of the WebTextField object on your webpage:

Me.ExecuteJavascript("document.getElementById('" + Me.ControlID + "_inner').step=10;") Me.ExecuteJavascript("document.getElementById('" + Me.ControlID + "_inner').min=0;") Me.ExecuteJavascript("document.getElementById('" + Me.ControlID + "_inner').max=100;")
Optionally we could make this one call to ExecuteJavascript, but for the client here, we subclass WebTextField, add properties for the inspector in the IDE to set them and then run those lines in the Shown event to pass to the browser if they are set.
13 03 20 - 14:40