Created
August 3, 2016 17:17
-
-
Save scottswaaley/3635b9a482d02642aa972a75817f4d97 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().setTitle("The Adding Machine"); | |
var formPanel = app.createFormPanel(); | |
var verticalPanel = app.createVerticalPanel(); | |
var label1 = app.createLabel("First Number: "); | |
var textBox1 = app.createTextBox().setName('textBoxResult1'); | |
var label2 = app.createLabel("Second Number: "); | |
var textBox2 = app.createTextBox().setName('textBoxResult2'); | |
var submitButton = app.createSubmitButton("Click to add the numbers together."); | |
verticalPanel.add(label1).add(textBox1).add(label2).add(textBox2).add(submitButton); | |
formPanel.add(verticalPanel); | |
app.add(formPanel); | |
return app; | |
} | |
function doPost(e) { | |
var app = UiApp.getActiveApplication(); | |
var sum = e.parameter.textBoxResult2 * 1 + e.parameter.textBoxResult1 * 1; | |
var label1 = app.createLabel(e.parameter.textBoxResult1 + " + " + e.parameter.textBoxResult2 + " = " + sum); | |
app.add(label1); | |
return app; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment