Error Message:

Oops! Your question couldn't be submitted because:

Please add some context to explain the code sections (or check that you have not incorrectly formatted all of your question as code).

How do I fix this issue?

It says that I need to explain my code more when I try to post this as google-apps-script. I have explained almost every part of the code. Also, this code was posted previously and I just added a few extra lines with explanations.

What do they mean by "context"

function doGet() {
  var app = UiApp.createApplication();
  //Create listBox
  var listBox = app.createListBox();
  //Add items to listBox
  listBox.addItem("item 1").addItem("item 2").addItem("item 3").setName("myListBox");
  //Create hidden app
  var hidden = app.createHidden().setName('hidden').setId('hidden')
  //Create button handler
  var handler = app.createServerHandler("buttonHandler");
  // pass the listbox into the handler function as a parameter and the hidden widget as well

  //Create flextable
  var table = app.createFlexTable().setId("myTable");

  //Create flex table style attributes
    table.setStyleAttribute("border-style", "solid")
    table.setStyleAttribute("border-width", "1px")

  //Create flex table headers
  table.setWidget(0, 0, app.createLabel("Product Type")).setStyleAttribute("color", "blue");
  table.setWidget(0, 5, app.createLabel("Size"));

  var button = app.createButton("+", handler);

  // add all widgets to the app
  return app;

function buttonHandler(e) {
  var app = UiApp.getActiveApplication();
  // get the position (is a string)
  var pos = e.parameter.hidden;
  // initial condition, hidden widget is empty
  // convert to number
  var table = app.getElementById("myTable");
  // add the new item at the right place
  table.insertRow(pos).insertCell( pos, 0).setText(pos, 0, e.parameter.myListBox);
  // increment position
  // save value
  // update app
  return app;
  • 28
    Just a tip, whenever you post something technical and use the word "I get an error", that sentence should always be followed with what that error actually said. Error messages aren't just garbage that the compiler or system throws out at you randomly. Error messages actually have meaning, and if you hope for people to be able to help you quickly, they'll need to be able to see these messages. Hope this helps!
    – jmort253
    Nov 24, 2012 at 18:45
  • 3
    Add some plaintext explanation of what you want to do, and what happens instead and please throw out most of those comments. They add no value. //increment position <- really? I would have guessed that ++pos increments the position. Nov 24, 2012 at 19:16
  • 1
    Thx for the tip guys. I added the exact error message. I am not sure what they mean when they say I need to add more "context" in the error message. Could someone explain what this means? I am brand new to the programming world, so I may need a little more explanation than the typical programmer. Nov 24, 2012 at 20:21
  • @user1833055 it is not a matter of being an experienced programmer or not. Your problem is not a programming issue. It is specifically a context issue. You have to actually ask a question with code to support. From what it looks like you just posted code as your question. You have 2 answers and 2 other comments saying the same thing. Just do what they said. Nov 24, 2012 at 20:35
  • 6
    No reason to massively downvote the guy. He just legitimately wanted help and was willing to listen and learn. +1
    – asteri
    Nov 24, 2012 at 21:36

2 Answers 2


Stack Overflow wants questions. That means that you have to ask an actual question, in text. You should probably include code to provide necessary context, but the actual question should be in text, in a paragraph preceding the code.

And no, comments in the code-block itself don't count.

  • 1
    Thx so much TRiG. I thought is was something more complex. I understand now. Thx again. Nov 24, 2012 at 21:23

I presume the system is rejecting your post because it's one big code block. It's not the code itself that you need to explain (most of your comments are entirely unnecessary anyway), it's the error - what you're trying to do with the code and, as jmort said, the precise error message. And you should read and at least try to understand the error message before posting.

Not the answer you're looking for? Browse other questions tagged .