Disabled p:commandButton renders invalid XHTML

UI Components for JSF
Post Reply
vetler
Posts: 9
Joined: 27 Aug 2010, 12:37

07 Sep 2010, 15:38

Hi,

In Primefaces 2.1, when the commandButton component is disabled (with disabled="true", as per the documentation), the XHTML rendered is:

Code: Select all

<button disabled="true" ... />
However, the W3C validator complains about this, and the correct syntax should be:

Code: Select all

<button disabled="disabled" ... />
This is a fairly common mistake, the correct way to write minimized attributes (selected, checked, disabled, etc.) in XHTML is to write them as foo="foo". See 4.5. Attribute Minimization. Is this a known bug? I was unable to find any issue on this in the issue tracker.

I tried setting disabled="disabled", but this did not seem to have the desired effect.

TIA,
Vetle

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

07 Sep 2010, 20:14

Hi,

HTML
<button disabled="disabled" ... />
should work. See http://www.w3schools.com/TAGS/tryit.asp ... n_disabled

JSF

Code: Select all

<p:commandButton disabled="disabled" ... />
doesn't work because disabled attribute is boolean (true / false) and not string.

This is a PF related issue in CommandButtonRenderer.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

07 Sep 2010, 22:00

Feel free to create an issue ticket about this as an enhancement. Don't think this will cause a bug but sounds good to generate valid markup for sure.

vetler
Posts: 9
Joined: 27 Aug 2010, 12:37

09 Mar 2011, 16:51

Hi again! :)

I created a bug a while ago, but it has not been fixed in Primefaces 2.2.1, unfortunately.
http://code.google.com/p/primefaces/iss ... il?id=1217

This isn't a serious issue, of course, but it would be nice if it could be fixed.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 47 guests