node.js - How do I format jade forms? -
i'm trying refactor app use jade instead of ejs running problems setting login form.
here's original form in ejs:
<% if (message) { %> <p><%= message %></p> <% } %> <form class="form-horizontal" action='/login' method="post" id="loginform"> <fieldset> <div id="legend"> <legend class="">login</legend> </div> <div class="control-group"> <!-- username --> <label class="control-label" for="username">username</label> <div class="controls"> <input type="text" id="username" name="username" placeholder="" class="input-xlarge"> </div> </div> <div class="control-group"> <!-- password--> <label class="control-label" for="password">password</label> <div class="controls"> <input type="password" id="password" name="password" placeholder="" class="input-xlarge"> </div> </div> <div class="control-group"> <!-- session--> <label class="control-label" for="rememberme">remember me</label> <div class="controls"> <input type="checkbox" name="rememberme"/> </div> </div> <div class="control-group"> <!-- button --> <div class="controls"> <button class="btn btn-success">login</button> </div> </div> </fieldset> </form>
and here's new form in jade:
extends layout block content if message p= message form(class='form-horizontal',action='/login',method='post',id='loginform') fieldset div#legand legend login div.control-group label(for='username',class='control-label') username div.controls input(type='text',id='username',name='username',placeholder='username',class='input-xlarge') div.control-group label(for='password',class='control-label') password div.controls input(type='text',id='password',name='password',placeholder='password',class='input-xlarge') div.control-group label(for='rememberme',class='control-label') remember me div.controls input(type='checkbox',name='rememberme') div.control-group div.controls input(type='submit',class='btn btn-success') login
codekit throwing error:
/applications/codekit.app/contents/resources/engines/jade/lib/runtime.js:173 throw err; ^ error: /users/sm/documents/projects/web_applications/app/app/views/login.jade:27 25| 26| > 27| invalid indentation, can use tabs or spaces not both @ object.lexer.indent (/applications/codekit.app/contents/resources/engines/jade/lib/lexer.js:672:15) @ object.lexer.next (/applications/codekit.app/contents/resources/engines/jade/lib/lexer.js:770:15) @ object.lexer.blank (/applications/codekit.app/contents/resources/engines/jade/lib/lexer.js:179:19) @ object.lexer.next (/applications/codekit.app/contents/resources/engines/jade/lib/lexer.js:744:15) @ object.lexer.blank (/applications/codekit.app/contents/resources/engines/jade/lib/lexer.js:179:19) @ object.lexer.next (/applications/codekit.app/contents/resources/engines/jade/lib/lexer.js:744:15) @ object.lexer.lookahead (/applications/codekit.app/contents/resources/engines/jade/lib/lexer.js:106:46) @ object.parser.lookahead (/applications/codekit.app/contents/resources/engines/jade/lib/parser.js:115:23) @ object.parser.peek (/applications/codekit.app/contents/resources/engines/jade/lib/parser.js:92:17) @ object.parser.tag (/applications/codekit.app/contents/resources/engines/jade/lib/parser.js:666:30)
how can past indentation error , form work? i'm using tabs , no spaces don't understand problem is.
this caused space in trailing empty lines in jade template (which don't post, there according error message).
Comments
Post a Comment