Created
August 3, 2016 17:23
-
-
Save scottswaaley/b88a9a5e7c2210aa7cec03bf731f99f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doGet() { | |
var app = UiApp.createApplication(); | |
var tb = app.createTextBox().setName("tb1"); | |
var lab1 = app.createLabel("This box wants only numbers. If you put in something other than a number, it will turn red."); | |
var badInput = app.createClientHandler().validateNotNumber(tb).forEventSource().setStyleAttribute("background", "red"); // turns red when a non-number is entered | |
var goodInput = app.createClientHandler().validateNumber(tb).forEventSource().setStyleAttribute("background", "white"); // turns white again when a number is entered | |
tb.addChangeHandler(badInput).addChangeHandler(goodInput); | |
app.add(lab1).add(tb); | |
return app; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment