0

I have Create a simple form that having three buttons. i need that buttons should be in a single row in table format.

Example:

<table><tr><td>button1</td><td>button2</td><td>button3</td></tr></table>

My Code :

table
    tr
        td
            form#formAddUser(name="viewAll",method="get",action="/userlist")        
                button#btnSubmit(type="submit") View All
        td
            form#formAddUser(name="new",method="get",action="/newuser")        
                button#btnSubmit(type="submit") New
        td
            form#formAddUser(name="delete",method="get",action="/delete")        
                button#btnSubmit(type="submit") Delete

But it showing error while accessing in browser that "Invalid indentation, you can use tabs or spaces but not both"

Please Help me !

3
  • Which code editor are you using? Apr 10, 2014 at 7:15
  • i just edited with text editor in ubuntu . . Apr 10, 2014 at 7:16
  • Do you have vim editor installed? Apr 10, 2014 at 7:25

1 Answer 1

0

This is what vim shows me with :set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<:

    table$
>------->-------tr$
>------->------->-------td$
>------->------->------->-------form#formAddUser(name="viewAll",method="get",action="/userlist")~~~~~~~~$
        >------->------->-------button#btnSubmit(type="submit") View All$
>------->------->-------td$
>------->------->------->-------form#formAddUser(name="new",method="get",action="/newuser")~~~~~~~~$
>------->------->-------        button#btnSubmit(type="submit") New$
>------->------->-------td$
>------->------->------->-------form#formAddUser(name="delete",method="get",action="/delete")~~~~~~~~$
>------->------->-------        button#btnSubmit(type="submit") Delete$

So, now you could understand where is the Tab and where Space is used. I recommend to use sublime or any other editors.

It proper edit it should look like, Major Edit in Your code was to indent the button inside form:

table$
>------->-------tr$
>------->------->-------td$
>------->------->------->-------form#formAddUser(name="viewAll",method="get",action="/userlist")$
>------->------->------->------->-------button#btnSubmit(type="submit") View All$
>------->------->-------td$
>------->------->------->-------form#formAddUser(name="new",method="get",action="/newuser")$
>------->------->------->------->-------button#btnSubmit(type="submit") New$
>------->------->-------td$
>------->------->------->-------form#formAddUser(name="delete",method="get",action="/delete")$
>------->------->------->------->-------button#btnSubmit(type="submit") Delete$


If you want to see the same in gedit i.e Ubuntu's Text Editor, Then check there is a gedit-plugins package available. Install that and take a look at the Draw Spaces section in the gedit preferences. You can configure it to show white spaces, tabs, line feeds etc.
Update: Below is the HTML sent to client

<table>
    <tr>
        <td>
            <form action="/userlist" id="formAddUser" method="get" name=
            "viewAll">
                <button id="btnSubmit" type="submit">View All</button>
            </form>
        </td>

        <td>
            <form action="/newuser" id="formAddUser" method="get" name=
            "new">
                <button id="btnSubmit" type="submit">New</button>
            </form>
        </td>

        <td>
            <form action="/delete" id="formAddUser" method="get" name=
            "delete">
                <button id="btnSubmit" type="submit">Delete</button>
            </form>
        </td>
    </tr>
</table>


Code share:

  1. ./package.json
  2. ./app.js
  3. ./views/index.jade

Do a npm install and hit http://127.0.0.1:3000

5
  • Even using vim, i can't resolve this problem guys. . Can anyone give me the code for the above example. . ? Apr 10, 2014 at 9:00
  • Each td should contain a form and a button. . Apr 10, 2014 at 9:01
  • @RajeevUlaganathan: As highlighted above, you should remove trail i.e. ~ & white spaces. I will update same in my answer.. Apr 10, 2014 at 9:20
  • Can you tell me the shared code is working for you? And you should use one white space or a tab for each level of indentation(in above example I had used tab) Apr 10, 2014 at 10:43
  • Oh . . i just picked that code from html to jade converter site. . and its working fine . . also thank u so much for your response . . Apr 10, 2014 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.