0

I encountered a problem on selectOneMenu component and the primefaces fileupload.

<h:outputLabel value="Categorie :"  />  
            <p:selectOneMenu  value="#{composantbean.selectedCategoryId}" required="true" >  
                <f:selectItem itemLabel="Select categorie" itemValue="" />  
                <f:selectItems  value="#{composantbean.listcat}" var="cat" itemValue="#{cat.nomCat}" itemLabel="#{cat.nomCat}" /> 
                <p:ajax update="panlecart2"  event="change" listener="#{composantbean.catListener()}"/>
            </p:selectOneMenu>   

My problem is at the display. the selectOneMenu is displayed but ItemLabel is hidden with a black color of my theme "trontastic"

enter image description here and the file upload is not displayed.

This problem no longer exite when I work with explorer instead of chrome or when I do

<p:commandButton value="Annuler" update="panel1" process="@this">
      <p:resetInput target="panel1" />
     </ p: commandButton>

enter image description here I should do, please thank you in advance

FERESSS
  • 137
  • 1
  • 5
  • 14

2 Answers2

1

I am not sure about the root cause but here is a temporary solution:

$(document).ready(function() {
    $(document.getElementById('button')).click();
});

And this script execute your button:

<p:commandButton id="button"value="Annuler" update="panel1" process="@this" style="display:none;">
      <p:resetInput target="panel1" />
</p:commandButton>

Try to give exact client id of the button inside javascript function. You can detect it via browser's settings.

About problem's itself; p:selectOneMenu showing the selected value inside of a label. I guess sth. overrides it's css, let give an id to your p:selectOneMenu(let say menu) and if it is exists inside of a form(let's say it's id is form). So you can try to change the css of that label via:

$(document.getElementById('form:menu_label')).css("width":150);

Or directly alter the css class which is .ui-selectonemenu label

Also to be able to avoid from view state bug ajax=false should be added into navigation button. Actually navigation should be done via links and their outcome property like here.

Community
  • 1
  • 1
Ömer Faruk Almalı
  • 3,792
  • 6
  • 37
  • 63
1

when I chnage my methode like this

public String Ajouter(){
    selcetitem=new Composant();
    return "AjoutC?faces-redirect=true";
}

instead of this

public String Ajouter(){
        selcetitem=new Composant();
        return "AjoutC";
    }

it works fine :)

FERESSS
  • 137
  • 1
  • 5
  • 14