JSF 2.2
Primefaces 6.0
The "emptyValue" attribute of p:inputNumber seems straightforward, and yet it is not working
<p:inputNumber id="wsMaxInput" emptyValue="empty"
value="#{officeResults.wsCountMax}" maxValue="3000"
minValue="0" styleClass="ondInput" />
Not only does it not look empty (I'm not sure if picture attaching will work from here), but when I hit "submit" the value is set to zero when it should be null.
What am I missing about this component?
Related
I am using PrimeFaces 6.1 SelectOneMenu to render a editable/filtered dropdown menu with itemLabel/value as selectItems. Unfortunately, selectOneMenu pick itemLabel as value put it in my selectOneMenu value field. This is very annoying issue and maybe it is a bug.
There is my snippet code:
I am using Map to hold ID/Name pair as selectItems:
Map<String,String> hm = new HashMap<String, String>();
hm.put("Cust001","John Dow");
hm.put("Cust002","Mark Polo");
hm.put("Cust003","Noel Max");
then I put it in my selectOneMenu as:
<p:selectOneMenu id="selectCustomerId" value="#{paymentControlBean.selectedCustomerId}" effect="fold" editable="true" filter="true" filterMatchMode="startsWith">
<p:ajax update="paymentListToolbar"/>
<f:selectItems value="#{hm.entrySet()}" var="entry" itemValue="#{entry.key}" itemLabel="#{entry.value}"/>
</p:selectOneMenu>
Dropdown list rendering works fine, but when I pick one from the dropdown list and then press process it. My backing bean paymentControlBean.selectedCustomerId shows up "John Dow", which means, selectOneMenu pick my itemLabel into my selectOneMenu's value field.
I tried to change the PrimeFaces element to p:selectOneListBox and keep everything no change, repeat the processing, my backing bean shows up "Cust001", which is working fine.
From this comparison I found out, there must a serious bug exists in PrimeFaces 6.1, and it is same bug existing in PrimeFaces 5.2 as well.
SelectOneMenu is very popular in dropdown list selection, especially when we have to handle key/value pairs by using Map.
If it is not a bug, what I can do or have an other work around to make it pick up right value in my selectItems?
Please advise>
I have fixed it with this PR: https://github.com/primefaces/primefaces/pull/2870
It will be in PrimeFaces 6.2 release coming out in November 2017.
The following works
<p:selectOneMenu value="#{f.entrada1}" editable="true">
As does
<p:inputMask mask="99:99" value="#{f.saida1}">
I do not seem to be able to combine the two in some way or add a mask to the editable p:selectOneMenu in a different way?
My PrimeFaces version is: ....
Version PrimeFaces 5.3.
Or put a list in inputMask. it's possible?
Primefaces (5.2, Mojarra 2.2.13) inside Dialog Framework is not opening a <p:confirm>-MessageBox.
I have delete icons in a datatable as a <p:commandLink> per row inside a Dialog.
I want to have a user confirmation to delete every row.
Following code works as expected in a <p:dialog> but not using Dialog Framework. Dialog Framework blocks the click on the delete icon or in other words: shows the confirm box invisible and answers NO.
<p:dataTable id="idTblMfc" value="#{bnMfcs.rows}" var="ORow" editable="true" ...>
... Columns ...
<p:column>
<p:commandLink styleClass="ui-icon ui-icon-trash" title="#{msg.TXT_DELETE}" actionListener="#{bnMfcs.doDelete(ORow)}" update="idTblMfc">
<p:confirm header="#{msg.TXT_DELETE}" message="#{msg.PRM_DEL_CONT_MARKED}" icon="ui-icon-alert" />
</p:commandLink>
</p:column>
I tried the same with <p:confirmDialog> instead of <p:confirm> with the same result. OK, I found the tiny difference that <p:confirmDialog> doesn't block the delete icon click but also does not appear.
The rest of the dialog and the datatable works as expected even with message boxen shown with showMessageInDialog(...).
Any ideas?
As you can see in the showcase (http://www.primefaces.org/showcase/ui/overlay/confirmDialog.xhtml), you need both p:confirm (where you need confirmation) and p:confirmDialog (which defines how the dialog looks like).
Also make sure that you are in a h:form tag.
Solution found!
The documentation makes not clear that <p:confirmDialog> is mandatory. I had one on my main page and the page using Dialog Framework had not.
I have below code for primefaces p:commandButton. I have set update and oncomplete attributes to disable commandButton in p:panelGrid of "panelGrid1s4a3b1" and show messages on p:message of "customMessage1s4". But does not know why these two not working. Anyone can help me to make them work?
<p:commandButton id="cmdVerify1s4a2" widgetVar="cmdVerify1s4a2"
value="Verify" action="approveProfileQualifications"
update="#([id$=panelGrid1s4a3b1]), #([id$=customMessage1s4])"
oncomplete="PF(cmdVerify1s4a2).disable(); PF('cmdReject1s4a2').disable();"/>
You are not updating is right. Change your p:commandButton little
update="panelGrid1s4a3b1 customMessage1s4"
while I believe your p:messages like
<p:messages id="customMessage1s4" showDetail="true" autoUpdate="true" closable="true" />
MORE
You can also use keywords to update:
Keywords are the easier way to reference components, they resolve to ids so that if an id changes,
the reference does not need to change. Core JSF provides a couple of keywords and PrimeFaces
provides more along with composite expression support.
Following are the keywords.
#this Standard Current component. #all Standard Whole view. #form
Standard Closest ancestor form of current component. #none Standard No
component. #namingcontainer PrimeFaces Closest ancestor naming
container of current component. #parent PrimeFaces Parent of the
current component. #composite PrimeFaces Closest composite component
ancestor. #child(n) PrimeFaces nth child. #row(n) PrimeFaces nth row.
#previous PrimeFaces Previous sibling. #next PrimeFaces Next sibling.
#widgetVar(name) PrimeFaces Component with given widgetVar.
I am using Primefaces 3.5, as shown in showcase, i am trying to use p:selectManyCheckBox.
<p:selectManyCheckbox layout="grid"
columns="2"
value="#{bean.selectedList}">
<f:selectItems itemLabel="#{bean.value}"
itemValue="#{overrides}"
value="#{bean.overrideValues}"
var="overrides>
</p:selectManyCheckbox>
But columns attribute is not working, is there any way to get column wise disply ?
I had the same problem and I fixed by changing the version of the prime face.
I had 3.2 and changed to 4.0.
For this particular component it seams that it whose added in the last 2 moth.
Requested here and a specific task here.
Is the second time when I also had this kind of problem. I am looking on the prime face showcase website for a specific component and and when I tried that component it didn't work with my version.