I came across the following answer: dynamically-add-remove-fields-on-input and don't know the site policy for this specific scenario.

Scenario

The following code allows users to enter multiple optional quantity fields after first filling in a value of the current quantity input. If the input field contains a value it will then display the next quantity field, if not, it will remove/not display it.

I requested the following information in the comments.

Don't you require a cascading effect?

OP response:

Thanks for pointing that out, I would prefer it to cascade. Should I update my question with this markup or would it be better to ask a new question?

Since an answer was already available, we suggested OP to write a follow-up question, in order not to invalidate the answer. However, no follow-up question was asked.

Then the new answer was posted, taking into account the cascading requirement from the comments, not available in the question.

Question

How should we proceed with this? Is the answer off-topic or is it acceptable? Does this new answer invalidate the accepted answer?

• TBH, I only glanced over the OP code, and wrote my answer based on the textual description. – morbusg Aug 14 at 18:45
• @morbusg Well, since you changed the behavior of the OP code, regardless of the trigger that made you do it :) it's good you edited your answer to include that part. As far as I'm concerned, your answer is now completely on-topic. – dfhwze Aug 14 at 18:47
• @dfhwze Just to be clear: Changing behavior of the code in an answer is acceptable, asking to change what the code does in a question is not. – Simon Forsberg Aug 20 at 10:08

One thing I would do at this point is to make sure that if all of the comments were cleaned up that the second answer would still make sense. If not, then quotes should be added to the second answer in order to contextualize it or it needs to be handled as not answering the question.

• Do you propose that hidden requirements are edited in the question, or in the answer? – dfhwze Aug 14 at 17:58
• @dfhwze the answer. Adding them to the question would invalidate the first answer – brug Aug 14 at 18:01
• Reviewer has taken your advice. I believe the matter is closed. – dfhwze Aug 14 at 18:37
With most Code Review questions you can think about the provided code in a different way than the OP has. This is how I've changed some $$\O(n^3)\$$ code to $$\O(n)\$$. I would never suggest penalties to answers that only suggest changing the code to $$\O(n^2)\$$ because they normally teach different things that can help the OP and other people in different ways. (Even if they provide a subset of my answer, why would I suggest penalizing them? That's just mean.)