10

When I load my Express webpage I'm getting the following error:

Express 500 Error: /app/views/index.jade:114 112| td 2 113| td 4 years > 114| input is self closing and should not have content.

112| td 2
113| td 4 years
> 114|
input is self closing and should not have content.
at Object.Compiler.visitTag (/app/node_modules/jade/lib/compiler.js:434:15)
at Object.Compiler.visitNode (/app/node_modules/jade/lib/compiler.js:210:37)
at Object.Compiler.visit (/app/node_modules/jade/lib/compiler.js:197:10)
at Object.Compiler.visitBlock (/app/node_modules/jade/lib/compiler.js:278:12)
at Object.Compiler.visitNode (/app/node_modules/jade/lib/compiler.js:210:37)
at Object.Compiler.visit (/app/node_modules/jade/lib/compiler.js:197:10)
at Object.Compiler.visitTag (/app/node_modules/jade/lib/compiler.js:443:12)
at Object.Compiler.visitNode (/app/node_modules/jade/lib/compiler.js:210:37)
at Object.Compiler.visit (/app/node_modules/jade/lib/compiler.js:197:10)
at Object.Compiler.visitBlock (/app/node_modules/jade/lib/compiler.js:278:12)

This doesn't show up when run locally with foreman start, only when its on the server.

Calvin Koder
  • 953
  • 2
  • 7
  • 12
  • 1
    Can you also include a snippet of `index.jade`, especially around lines 112-114? The error is suggesting that the view is trying to create an `` element with content (as in `content`), which isn't valid markup. – Jonathan Lonowski Dec 24 '13 at 00:50
  • `table#activity(name="activity") tr.sell td 2 td 4 years` – Calvin Koder Dec 24 '13 at 00:57

5 Answers5

16

Looks like you've got content inside your input tags. In HTML, input tags can't have content,
therefore you should delete any whitespace or characters following input tags in your jade file.
Ex:
input(type="text",name="whatever") something
should be
input(type="text",name="whatever",value="something")

Jephron
  • 2,652
  • 1
  • 23
  • 34
1

Sometimes the answer is a little tricker than just some content after the tag on the same line (such as a few spaces). Watch out for the line following the input tag being indented by mistake!

MindWire
  • 3,969
  • 7
  • 34
  • 46
0

I had a similar problem I solved with this:

div
   +inputWithTextContent('whatever', 'something')


mixin inputWithTextContent(name, message)
  !='<input type="text" name="'+name+'">'+message+'</input>'
Shyam Bhimani
  • 1,310
  • 1
  • 22
  • 37
BaikeN9
  • 66
  • 1
  • 3
0

After running into the same error I was checking the line of jade template marked in error report. It was actually containing input definition, but that definition was fine for there wasn't any whitespace and printable content succeeding it. The following line was even less indented (two levels up for starting another row of form) and thus there was definitely no content to input element defined in marked line.

However there was another input succeeding this marked one a few lines down the template. And that input element indeed was having some subordinated content. Removing content there was fixing somewhat false positive "here".

Thomas Urban
  • 4,649
  • 26
  • 32
0

Another solution is to create a label after the input and then display it inline. This will sit the label along side the control. This is how I solved the issue with a checkbox input in jade.

JADE (Bootstrap):

      .checkbox
      label 
        input(type='checkbox', value='remember-me',)
        label.inlineLabel Remember me

SASS:

label.inlineLabel
   display: inline