How to disable "form input without label" warning and how to enable duplicate element ID warning?

Question 1: PhpStorm highlights input tags that don't have an associated label, but to my knowledge a label isn't required (and I never use them), so I'm wondering if there is a way to turn off the warnings?

Question 2: I've noticed that PhpStorm doesn't how a warning when multiple elements have the same IDs. Is there a setting to turn this type of warning on? I think it would be really useful..

Thanks!

4 comments
Comment actions Permalink

1. Sure - just disable the 'Form input without an associated label' inspection (Settings/Inspections/HTML)
2. Normally ir shows 'Duplicate ID reference' error in such cases... Can you provide a sample code where this error is not flagged for you?

0
Comment actions Permalink

Thanks, that worked great!

I don't seem to be getting any Duplicate ID reference error. Here's an example (test.php, also attached):

<?php
// code here
?>
<!DOCTYPE html>
<html>
<head></head>
<body>

<form method="get" name="mainForm" action="">
    <input type="text" id="name" name="name[]">
    <input type="text" id="name" name="name[]">
    <input type="text" id="name" name="name[]">
    <input type="text" id="name" name="name[]">
    <input type="text" id="name" name="name[]">
</form>

</body>
</html>

There's no highlighting, even though all of those inputs have the same "id" attribute (which isn't valid). Screenshot: http://imageshack.com/a/img19/7859/nwun.png

I'm using PhpStorm 7.1.3, but I don't think it worked in v6 either.

Thanks.



Attachment(s):
test.php.zip
0
Comment actions Permalink

Works fine for HTML, doesn't work for HTML in .php. Looks like a bug to me

0
Comment actions Permalink

Could it be as "cheap" attempt to fix http://youtrack.jetbrains.com/issue/WI-5020 and alike (as it's much easier to just turn off such inspection for PHP files compared to implementing such fix properly (properly track all of these if-then-else logic etc))?

0

Please sign in to leave a comment.