facebook

HTML validator warns EL expressions for boolean values

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #336215 Reply

    Dwight
    Participant

    The MyEclipse HTML editor, on .xhtml files, gives me a warning on attributes that accept boolean values if I have an expression, although in some cases the warning goes away later. For example:

    
    <html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:ice="http://www.icesoft.com/icefaces/component">
    <h:head>
    </h:head>
    <h:body>
        <ice:selectInputText disabled="#{true}" value="#{bean.name}">
                <f:selectItem value="A}" />
        </ice:selectInputText>
    </h:body>
    </html>
    

    When I change anything in the selectInputText tag, I get a warning on the disabled value that says ‘Valid values are “true” or “false” ‘. A ‘rendered’ attribute has the same problem. So the warning appears while I’m editing, and remains after I have saved the changes, and the progress window shows no further operations. However, in my small test case, if I simply switch to a different editor tab (some unrelated file), then back to this file’s tab, the warning indicators are there for about 1 second, then disappear. In my real application files, many of the warnings remain after switching tabs, although some disappear.

    To edit the file, I did “Open with…” and selected ‘MyEclipse HTML editor’. I also tried opening with ‘MyEclipse Visual XHTML designer’ and had the exact same results editing in the source pane.

    If I rename the file to *.jsp, then the MyEcllipse JSP editor gives no warning with the same code.

    Running MyEclipse 10.7.1.

    #336221 Reply

    Dwight
    Participant

    Playing with this some more, I found a change that makes the warning remain, even after switching tabs.

    
    <h:body>
        <h:form>
          <ice:selectInputText disabled="#{true}" onfocus="stuff();" value="#{bean.name}"> 
             <f:selectItem value="A}" /> 
       </ice:selectInputText> 
        <ice:commandLink value="Save" onfocus="showErrors();"
            action="#{bean.actionSomething}" />
        </h:form>
    </h:body>
    

    Adding the “onfocus” attribute made the warning stable — it no longer disappears after switching editor tabs. Using onclick or onmouseup had a similar effect.

    Note that there’s a somewhat similar problem with action attributes – gives a warning ‘The action value does not match a navigation case outcome.’

    #336225 Reply

    dwighte,

    The value for disabled attribute should be either ture / false. In your case you have given an expression for disabled attribute. You can click content assist (CTRL + SPACE) in between the double quotes (disabled=””) and you will find that only “true” / “false” options are shown. So, the warning “Valid values are true or false ” that appears if you enter an expression is correct. But that warning is disappeared once you open another file is an issue. I will ask the dev team to look into this issue.

    Can you please change the disabled attribute value to “true” instead of “#{true}” ?

    Let us know if you see any issues.

    #336266 Reply

    Dwight
    Participant

    I use EL expressions for the disabled attribute and rendered attribute all the time. I put “#{true}” in my example above as the minimal example, but usually it includes a reference to a bean’s boolean field, e.g.

    
    disabled="#{bean.editMode}"
    

    and this works fine, that is, the controls are displayed as I would expect. It’s just the editor/validator that complains about it.

    If you use the JSP editor, the content assist choices include “new EL expression”, besides true and false.

    #336277 Reply

    dwighte,

    Sorry that you are seeing this issue. We have filed a PR for this one and the dev team will look into it. Thanks for pointing to this issue.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: HTML validator warns EL expressions for boolean values

You must be logged in to post in the forum log in