Possible BUG with p:commandButton with no VALUE

UI Components for JSF
rafaeltscs
Posts: 44
Joined: 18 Dec 2010, 23:10

21 Dec 2011, 20:29

If I use a commandButton to render a button with image only (no text value) it renders a text "ui-button" as a value for the component.

Example:

Code: Select all

<p:commandButton id="btAddItem" styleClass="bt bt_add"
	action="#{bean.prepareCreateItem}" ajax="false" />
PS.: the class bt_add uses a background-image to show de add icon over the button.

rendered code:

Code: Select all

<button .... > 
     <span class="ui-button-text">ui-button</span>
</button
NetBeans 7.3, Glassfish 3.1.2, Java EE 7, PrimeFaces 3.5 , Mojarra 2.1.17

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

21 Dec 2011, 20:56

Why do you perceive this as a bug? Are you able to click the rendered button, and is the non-AJAX request sent to the server?
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

rafaeltscs
Posts: 44
Joined: 18 Dec 2010, 23:10

21 Dec 2011, 21:13

It works fine, but it is rendered wrong. I do not want a label in my button and it adds a label containing the text "ui-button".
NetBeans 7.3, Glassfish 3.1.2, Java EE 7, PrimeFaces 3.5 , Mojarra 2.1.17

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

21 Dec 2011, 21:30

If you think it is a bug, then create an issue, and ask Cagatay (PrimeFaces lead/owner) for a response to the question if this is a bug or not, or express your concerns about how it is rendered...there in the issue tracker.

Have you considered using standard JSF button tags instead of PrimeFaces p:commandButton, since you are not satisfied with how p:commandButton is rendered when no value is specified?
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

KingdomHeart
Posts: 280
Joined: 25 Jun 2010, 01:18

21 Dec 2011, 21:47

@rafaeltscs: I am sure this is your mistake not PF. First of all the showcase work, also look at my code below

Code: Select all

<h:head>
      <style type="text/css">
               .delete{
                       background-image: url(images/delete.png) !important;
               }
      </style>
</h:head>
<h:body>
       <h:form>
              <p:commandButton icon="delete"/>
       </h:form>
</h:body>
on the same level as your .xhtml file, make sure you have folder "images" with "delete.png" in it.

Mojarra 2.1.10, Glassfish 3.1, Tomcat 7, Primeface 3.3.1
IE 6-8, FireFox 10-13
MAC OSX Lion, Windows XP, 7

rafaeltscs
Posts: 44
Joined: 18 Dec 2010, 23:10

21 Dec 2011, 22:13

I understand what you mean. But I am just saying that if I put no value for it, it should be kept with no value. No text.

Using the icon attribute does not work for me because I have an image which overrides the button's background, and this image contains the icon. So if I use this attribute, it will looks like 2 nested buttons. What I wanna do is simply overrides the button's background and keep it with no label. I know it is not the best way of doing it, but I have no time to recreate the images and separate the icon of the BG.

BTW.. I could get what I want setting value=""
NetBeans 7.3, Glassfish 3.1.2, Java EE 7, PrimeFaces 3.5 , Mojarra 2.1.17

rafaeltscs
Posts: 44
Joined: 18 Dec 2010, 23:10

21 Dec 2011, 22:18

@smithh032772: yes I did. the h:commandButton it is rendered as I expected. I just wanted to open a thread here to make sure if the p:commandButton is supposed to behave this way.
NetBeans 7.3, Glassfish 3.1.2, Java EE 7, PrimeFaces 3.5 , Mojarra 2.1.17

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

21 Dec 2011, 22:27

rafaeltscs wrote:@smithh032772: yes I did. the h:commandButton it is rendered as I expected. I just wanted to open a thread here to make sure if the p:commandButton is supposed to behave this way.
Sounds good to me. In the meanwhile, or whenever you get a chance, can you update your Profile in User Control Panel, and add a signature similar to mine with your development/test environment, so we all will know...when trying to respond to any/all your future posts? Thank you kindly. :)
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

rafaeltscs
Posts: 44
Joined: 18 Dec 2010, 23:10

21 Dec 2011, 22:46

Sure! Just did it!
NetBeans 7.3, Glassfish 3.1.2, Java EE 7, PrimeFaces 3.5 , Mojarra 2.1.17

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

21 Dec 2011, 22:53

Smiling... perfecto! I have to 'like' that! Where's the like or +1 button/hyperlink at???

Your test/development environment is very similar to mine, but you're using Eclipse and I'm using NetBeans? Is all that really your test/dev environment?
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 22 guests