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 8650299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:47:07+00:00 2026-06-12T13:47:07+00:00

Dont know why return unexpected error ocurred: I am trying to edit a caption

  • 0

Dont know why return unexpected error ocurred:

I am trying to edit a caption panel but if i make “return app”, error appears.
My function panel Admin creates my Captionpanel and my function createActivatePanelAdmin gets the caption panel and try to edit the content becouse if one itembar is selected the content of Caption Panel must change.

function panelAdmin(){

  var app = UiApp.getActiveApplication();
  var ss = SpreadsheetApp.openById(LOGS_SHEET_ID);
  var verticalPanelAdmin = app.createVerticalPanel().setId("verticalPanelAdmin");
  var mainPanelIndex = app.createCaptionPanel().setText("Index");

  var menuBar = app.createMenuBar().setId("menuBar").setAnimationEnabled(true);//For vertical menubar(true)

  var hdPanelAdminIndex = app.createServerHandler("createPanelAdminIndex").addCallbackElement(mainPanelIndex);
  var hdPanelCreateUserPanel = app.createServerHandler("createUserPanelAdmin").addCallbackElement(mainPanelIndex);
  var hdPanelActive = app.createServerHandler("createActivatePanelAdmin").addCallbackElement(mainPanelIndex);
  var hdPanelDeleteUserPanel = app.createServerHandler("deleteUserPanel").addCallbackElement(mainPanelIndex);
  var hdPanelSearchUserPanel = app.createServerHandler("searchUserPanel").addCallbackElement(mainPanelIndex);
  var hdPanelExitUserPanel = app.createServerHandler("ExitUserPanel").addCallbackElement(mainPanelIndex);

  var menuItem0 = app.createMenuItem('Inicio ', hdPanelAdminIndex);
  var menuItem1 = app.createMenuItem('Crear Usuarios', hdPanelCreateUserPanel);
  var menuItem2 = app.createMenuItem('Activar Usuarios', hdPanelActive);
  var menuItem3 = app.createMenuItem('Borrar Usuarios', hdPanelDeleteUserPanel);
  var menuItem4 = app.createMenuItem('Buscar', hdPanelSearchUserPanel);
  var menuItem5 = app.createMenuItem('Salir', hdPanelExitUserPanel);
  //top level menu items


  //create menuItem separators
  var separator0 = app.createMenuItemSeparator();
  var separator1 = app.createMenuItemSeparator();
  var separator2 = app.createMenuItemSeparator();
  var separator3 = app.createMenuItemSeparator();
  var separator4 = app.createMenuItemSeparator();
  var separator5 = app.createMenuItemSeparator();

  //Add the menu item separators and menuItem to the MenuBar
  menuBar.addSeparator(separator0).addItem(menuItem0).addSeparator(separator1)
    .addItem(menuItem1).addSeparator(separator2)
    .addItem(menuItem2).addSeparator(separator3)
    .addItem(menuItem3).addSeparator(separator4)
    .addItem(menuItem4).addSeparator(separator5)
    .addItem(menuItem5).addSeparator(separator0);
  verticalPanelAdmin.add(menuBar);
  verticalPanelAdmin.add(mainPanelIndex);
  app.add(verticalPanelAdmin);

  return app;

};

  function createActivatePanelAdmin(){

  var ss = SpreadsheetApp.openById(LOGS_SHEET_ID);
  var app = UiApp.getActiveApplication();
  var verticalPanelAdmin = app.getElementById("verticalPanelAdmin");

  var menuBar = app.getElementById("menuBar");
  var mainPanelIndex = app.getElementById("mainPanelIndex");
      mainPanelIndex.setText("Sistema de creación de usuarios");

  var mainPanelActivateAdmin = app.createHorizontalPanel().setId("mainPanelActivateAdmin");


      /*FROM HERE WORKS CORRECTLY (TESTED)*/

  var lastCol = ss.getLastColumn();
  var rowsToConfirm = confirmReg();
  var lastRow = numRows(rowsToConfirm);


  if (rowsToConfirm != null){
    var flexTableRegAdmin = app.createFlexTable().setId("flexTableRegAdmin").setBorderWidth(1);
    flexTableRegAdmin.setText(0, 0, "ID");
    flexTableRegAdmin.setText(0, 1, "NOMBRE");
    flexTableRegAdmin.setText(0, 2, "PASS");
    flexTableRegAdmin.setText(0, 3, "EMAIL");
    flexTableRegAdmin.setText(0, 4, "ESTADO");
    flexTableRegAdmin.setText(0, 5, "ACTIVAR");

    var check = new Array(lastRow);

    for(var r = 0; r < lastRow; r++){
      for(var c = 0; c < lastCol; c++){
        var text = rowsToConfirm[r][c].toString();

        flexTableRegAdmin.setText(r+1, c, text);


      }
      var id = rowsToConfirm[r][0];
      check[r] = app.createCheckBox().setName("chk_"+id).setId("chk_"+id);
      flexTableRegAdmin.setWidget(r+1, lastCol, check[r]);
    }//end fors
  }//end if

  var botMod = app.createButton().setText("Activar").setId("botStatus");
  var botHandle = app.createServerHandler("changeStatus").addCallbackElement(mainPanelActivateAdmin);
  botMod.addClickHandler(botHandle);

  /*TO HERE*/


  mainPanelActivateAdmin.add(flexTableRegAdmin);
  mainPanelActivateAdmin.add(botMod);

  mainPanelIndex.add(mainPanelActivateAdmin);
  return app;
  };

**Thanks for help! AND I have to say that the flextable is ok, i builded it in other site so don’t spend your time trying to see if the error is in Flextable or botton_send **

THE PROBLEM IS IN PANELS (I tried to clear code)

Thats is

EDIT: (I am only trying to remove the captionPanel and i can’t. Unexpected error)

function createActivatePanelAdmin(){

  var app = UiApp.getActiveApplication();
  var verticalPanelAdmin = app.getElementById("verticalPanelAdmin");
  var mainPanelIndex = app.getElementById("mainPanelIndex");
  verticalPanelAdmin.remove(mainPanelIndex);
  return 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-12T13:47:08+00:00Added an answer on June 12, 2026 at 1:47 pm

    I agree with Waqar, your code is not testable since it calls variables defined outside of it.

    These errors occurs often when you try to get by ID something with the wrong ID (ie an id that doesn’t exist), so I’d recommend you dubble check every ID of every panel and widgets you use, there might be a typo somewhere…

    EDIT : there is one error I think I (maybe) found :

    in the first part of the code you wrote :

      var verticalPanelAdmin = app.createVerticalPanel().setId("verticalPanelAdminIndex");
    

    and in the second function you call this panel with :

      var verticalPanelAdmin = app.getElementById("verticalPanelAdmin");
    

    The ID’s are different… is that normal ?

    EDIT 2 : also a problem here … First function :

     var mainPanelIndex = app.createCaptionPanel().setText("Index");// no ID is defined
    

    and then you call it with

      var mainPanelIndex = app.getElementById("mainPanelIndex");
    

    try it and keep checking yourself also please…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my query i need to return IEnumerable but i dont know if this
The following code returns an error and I dont know why: require rexml/document include
I dont know how to debug structures like: fun1 <- function(obj){ a<-c(obj,4) c(a,5) }
I dont know what happend but I cant register any dlls anymore. It seems
I dont know where my error is in this mysql query $sql = INSERT
I wanna return a link inside to <img> . I dont know what is
I dont know but since using iOS5 (now 5.1) and Xcode 4 (now 4.3)
Sorry but I dont know what title I should give this question(Suggestion?) I have
I am trying to make a call with this script, but am getting a
I dont know how can I make threads in C, i saw a review

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.