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

  • SEARCH
  • Home
  • 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 8215515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:48:46+00:00 2026-06-07T11:48:46+00:00

Question 1) When a button is clicked is it possible to use something like

  • 0

Question 1) When a button is clicked is it possible to use something like this (see code below)?

function Submit(e) {
  var app = UiApp.getActiveApplication();
  var checked = app.getElementById("checkbox").getValue();
}

Question 2) When a label is clicked is it possible to use something like this (see code below)?

function LabelClick(e) {
  var LabelText = e.parameter.getText();
}

Sorry, this probably stupid, but I can’t see to find any decent examples of this and can’t seem to work this out from Google’s documentation and I’m just getting used to google script too. If you have the answer I would really appreciate it.

  • 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-07T11:48:49+00:00Added an answer on June 7, 2026 at 11:48 am

    you are not very far… but not close enough to get it working…

    Ui element’s value is sent to the handler function in a so called callbackelement that is added to the handler. This callbackelement may be a button, a label or, more easily, the parent widget that contains all the other widgets. These “elements” are in the “e” of the handler function and are identified by their names.
    In the other direction, ie if you need to modify an Ui element from another function then you can get this element by its ID (getElementbyId()) and assign it a value just the same way as you’d do it in the UI definition function.

    I copy/paste a sample code from another post to illustrate what I said, you can see the e.parameter.chkmode that holds the value of the checkBox and I’ll add a Label to show the reverse process (the text is changed when the button is clicked).

    Hoping I was clear enough,

    var sh = SpreadsheetApp.getActiveSheet();
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    //
    function move() {
       var app = UiApp.createApplication().setTitle("move test")
           .setHeight(100).setWidth(400).setStyleAttribute("background-color","beige");
       var panel = app.createVerticalPanel();
       var next = app.createButton('next').setWidth('180');
       var chkmode = app.createCheckBox("moving mode (checked = up/dwn, unchecked=L/R)").setValue(false).setName('chkmode');
       var label = app.createLabel("test Label with text that will be modified on click").setId('label');
       panel.add(next).add(chkmode).add(label);
       var handler = app.createServerHandler('click').addCallbackElement(panel);
       next.addClickHandler(handler);
       app.add(panel);
       ss.show(app);
     }
    //
    function click(e) {
      var app = UiApp.getActiveApplication();
      var activeline = sh.getActiveRange().getRow();// get the row number of the selected cell/range
      var activecol = sh.getActiveRange().getColumn();// get the row number of the selected cell/range
      var label = app.getElementById('label');
      label.setText('You have clicked the button');
      var chkmode=e.parameter.chkmode;
      if(chkmode=="true"){
        activeline++
        }else{
          activecol++}
      var sel=sh.getRange(activeline,activecol);
      sh.setActiveSelection(sel);// make the next row active
      return app;
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a question on how to detect which button was clicked in the
Question I am trying to use a button to delete the first entry to
My question is simple, How to hide back button in navigation bar? I see
This is probably a basic html/css question... I have a simple one-button form that
Thanks in Advance for reading and answer this question. I got button in asp
Trying to understand this binding process of the WPF. See the code at the
Possible Duplicate: WPF Button isPressed and isEnabled problem Here is a snippet of code
I am having below code to send the value of radio button people have
I have a view with a button which downloads files when clicked. Question I
Changed Question: 5/5/12 2:34pm (PST) I would like to know if it is possible

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.