diff --git a/common/lib/capa/capa/responsetypes.py b/common/lib/capa/capa/responsetypes.py
index d327b80c14..fcb36a1d03 100644
--- a/common/lib/capa/capa/responsetypes.py
+++ b/common/lib/capa/capa/responsetypes.py
@@ -873,6 +873,7 @@ def sympy_check2():
msg = 'No answer entered!' if self.xml.get('empty_answer_err') else ''
return CorrectMap(idset[0], 'incorrect', msg=msg)
+ # NOTE: correct = 'unknown' could be dangerous. Inputtypes such as textline are not expecting 'unknown's
correct = ['unknown'] * len(idset)
messages = [''] * len(idset)
@@ -898,6 +899,7 @@ def sympy_check2():
if type(self.code) == str:
try:
exec self.code in self.context['global_context'], self.context
+ correct = self.context['correct']
except Exception as err:
print "oops in customresponse (code) error %s" % err
print "context = ", self.context
diff --git a/common/lib/capa/capa/templates/textinput.html b/common/lib/capa/capa/templates/textinput.html
index 7f2f563b81..08aa8379a7 100644
--- a/common/lib/capa/capa/templates/textinput.html
+++ b/common/lib/capa/capa/templates/textinput.html
@@ -38,5 +38,7 @@
% if msg:
${msg|n}
% endif
+% if state in ['unsubmitted', 'correct', 'incorrect', 'incomplete'] or hidden:
+% endif