Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8803987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:29:11+00:00 2026-06-14T01:29:11+00:00

I have basically modified a UI that comes on the UI google documentation to

  • 0

I have basically modified a UI that comes on the UI google documentation to adapt it to my needs. I have a panel that gets info from user, then it is supposed to replace some words in a template and at the end send an email. This is what I have written so far. Everything works great just the part where it makes the replace is not working which(var Time = setValue(e.parameter.userName) but I am not sure if is correct or I should use something different. I tried using var Time = emailTemplate.replace(“TIME”,e.parameter.userName)); but I get reference error, e is not defined and is not running. Any help would be appreciated.

 function onOpen() {
var subMenus = [{name:"test", functionName: "doGet"}];
           SpreadsheetApp.getActiveSpreadsheet().addMenu("texts", subMenus);}

    function doGet() {
  var doc = SpreadsheetApp.openById("SP ID");
  var app = UiApp.createApplication().setTitle('TITLE1');
  var grid = app.createGrid(10, 10);
  grid.setWidget(0, 0, app.createLabel('Time PST'));

   grid.setWidget(0, 1, app.createTextBox().setName('Time'));
  grid.setWidget(1, 0, app.createLabel('Minutes have passed'));

  grid.setWidget(1, 1, app.createTextBox().setName('Minutes'));
  grid.setWidget(2, 0, app.createLabel('Enter Name'));
  grid.setWidget(2, 1, app.createTextBox().setName('Name'));
  // Create a vertical panel..
  var panel = app.createVerticalPanel();

  // ...and add the grid to the panel
  panel.add(grid);


  var button = app.createButton('Submit');
  var handler = app.createServerHandler('b');
  handler.addCallbackElement(grid);
  button.addClickHandler(handler);

  // Add the button to the panel and the panel to the application, then display the                      application app
    panel.add(button);
    app.add(panel);
  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
  spreadsheet.show(app);
  }


  function b() {

    var doc = SpreadsheetApp.openById("SP ID");
    var emailTemplate =                              SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Templates").getRange("A1").getValue() ;
    var address = "albdominguez25@gmail.com";
    var Time = setValue(e.parameter.Time);
    var emailSubject = "Subject";
    emailTemplate = emailTemplate.replace("TIME",Time);  


    MailApp.sendEmail(address, emailSubject, emailTemplate);
    Browser.msgBox("Your Email has been sent!");


    // Clean up - get the UiInstance object, close it, and return
    var app = UiApp.getActiveApplication();
    app.close();
    // The following line is REQUIRED for the widget to actually close.
    var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
  spreadsheet.show(app);
  }​
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T01:29:13+00:00Added an answer on June 14, 2026 at 1:29 am

    I’m assuming you want to change the text in the TextBox ‘Time’ when the button is clicked.

    First, you need to set an id on the text box

    function doGet(){
      ...
      grid.setWidget(0, 1, app.createTextBox().setName('Time').setid('Time');
      ...
    }
    

    Then, you need to use setText() on the TextBox to change the value

    function b(e){ // Note the argument 'e'
      ...
      var Time = app.getElementById('Time').setText(e.parameter.Time);
      ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I basically have a program that filters records from one excel file to another
I want to have an auto login option check for a user. Basically that
I am using WickedPDF, and I have basically two gems that include the binaries:
I'm testing a C++ class with a number of functions that all have basically
I have in my model an object, that when modified requires a large number
I have the following in my tags controller ( params[:q] comes from this plugin:
I have an amenities model that basically has a bunch of boolean columns. I
I have some general scripts that I use and they keep getting modified over
I have this temp table that holds the data to be modified in table1,
I have a revision.txt file in my SVN project. Basically I want that this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.