0
votes

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();"/>
1

1 Answers

1
votes

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.