I have the following html code in my google app. IT should call the function below but I'm getting nothing. I've used the same script throughout my code until now
<div id= "right_column">
<p>
<input type="button" value="Enter Grades for Selected Lessons"
onclick="google.script.run.withSuccessHandler(showMsgForLoginAttempt).generate_grades_for_lesson(this.parentNode)"/>
</p>
</div>
Here is the code for the function
function generate_grades_for_lesson(formObject) {
msgBox("Hello");
}
Any help is appreciated
Use form instead of p around the form elements.
Use type="text" for value
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<div id= "right_column">
<form>
<input type="text" name="grades" placeholder="Grades...">
<input type="button" value="Enter Grades for Selected Lessons"
onclick="google.script.run.withSuccessHandler(showMsgForLoginAttempt).generate_grades_for_lesson(this.parentNode)"/>
</form>
</div>
</body>
</html>
<script>
function showMsgForLoginAttempt() {
console.log("success");
}
</script>
Use Browser.msgbox in google apps script
function generate_grades_for_lesson(formObject) {
Browser.msgBox("Grades: " + formObject.grades);
}