2

I'm using NetBeans to write PHP code embedded in HTML. When I use PHP to generate an id attribute, as here:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <div id="<?php echo 'TEST_ID'?>">
            TEST
        </div>
    </body>
</html>

... I get the following error message:

Bad value " " for attribute "id" on element "tr": An ID must not contain whitespace.

How can I disable or remove this error from my Netbeans for PHP?

enter image description here

Solution

Haha after trying again my self found how to disable this stress IDE but I love it :D

see screenshot ^_^

enter image description here

Álvaro González
  • 142,137
  • 41
  • 261
  • 360
Kannika
  • 2,538
  • 2
  • 27
  • 38
  • seems like – sas Jan 08 '14 at 10:17
  • show the full code please – user2936213 Jan 08 '14 at 10:17
  • event sample code it's still error of this every attribute ID with `` inside. – Kannika Jan 08 '14 at 10:19
  • I think it's because it's omitting the PHP code and reads as `` – AyB Jan 08 '14 at 10:19
  • @crack : you see the inside `ID="HERE_NO_WHITESPACE"`, there is only ``. – Kannika Jan 08 '14 at 10:23
  • no after tr @Kannika. can you post the code – sas Jan 08 '14 at 10:24
  • 1
    Can you please paste your whole code here rather than this screenshot? – user2936213 Jan 08 '14 at 10:24
  • I update my question to make it clear now. – Kannika Jan 08 '14 at 10:32
  • Is your netbeans enabled with php? – user2936213 Jan 08 '14 at 10:52
  • check this http://bits.netbeans.org/netbeans/trunk/nightly/latest/ which package have you downloaded. – user2936213 Jan 08 '14 at 11:05
  • haha i found the solution thanks guys for help ! it's not code error but IDE bug – Kannika Jan 08 '14 at 11:05
  • @Vicario : my problem is not with the code problem but it's a bug from Netbeans IDE 7.4. Did you read all my question and the comment above? If I have problem with my code I will post them. So I post a screenshot of a less code and it still got the error. And also my question is "How disable it?" not "how to solve my error code". thanks you for comment again :) – Kannika Jan 09 '14 at 04:48
  • Also, this post can be close because it's not the problem of coding. but it's problem of IDE and how to fixed or disable this detection. I just don't know where to ask this question and i post it here. – Kannika Jan 09 '14 at 04:49
  • 1
    @Kannika - When I read your question, my first idea to trouble-shoot the issue is to load the code in my own copies of NetBeans (I actually have several versions installed), verify whether I can reproduce it and see if there's a setting I can change to fix it. But you've apparently assumed that's a bad approach and took an extra work just to discourage it. You even seem annoyed when asked for further details ("please don't make me post my code", "did you read my question?"). Sorry but you are just giving the impression that solving your problem is a game and a privilege for us. – Álvaro González Jan 09 '14 at 09:28
  • 1
    BTW, I've just edited the question for you since the problem itself can be interesting for other people. I was tempted to remove your answer (you must click the "Add Another Answer" button and type stuff there rather that embedding the answer in the question itself) but I decided to give you a chance to copy it into a proper answer (you are encouraged to answer your own questions) which you can even accept. – Álvaro González Jan 09 '14 at 09:52
  • @ÁlvaroG.Vicario : thanks for your suggestions. I almost got stress and got bother this bug and some pressure too. and sorry for my bad there guys. – Kannika Jan 10 '14 at 03:12

2 Answers2

5

It appears to be a known issue: the NetBeans HTML validator doesn't support embedded PHP code, thus it's trying to validate your literal PHP code as if it was part of the HTML received by the browser (which is of course not the case). The NetBeans team is apparently not willing to fix it (probably because it'd need a full rewrite of the feature) so you have to either live with that or disable HTML error checking. You can accomplish the latter from the hint icon (lightbulb) in the IDE margin; the feature can be disabled in a per-file bases or for all PHP files.

Álvaro González
  • 142,137
  • 41
  • 261
  • 360
2

I just ran into this issue myself and could not find any info on how to resolve. I didn't want to disable all error checking for HTML so with some trial and error I discovered that the required setting to disable was "Attributes" in the HTML Validator.

  1. Go to NetBeans > Preferences
  2. Select Editor > Hints
  3. Choose Language "HTML"
  4. Uncheck Attributes
  5. Apply or OK

This will disable a few other validators but it is better than turning validation off all together.

Another option is to change the "Show As" option to something less intrusive like "Info"

Ecks
  • 103
  • 1
  • 8