I searched a lot and I did not find any solution. I am using primefaces 5.2 version. Here is my code:
<p:dialog header="#{msg['table.playlist.edit.caption']}" widgetVar="editPl" id="editPl" appendTo="@(body)" modal="true" minHeight="100">
<h:form id="editForm">
<h:panelGrid id="editPanel" columns="3" cellpadding="5">
<h:outputText for="fieldName" value="#{msg['table.playlist.column.header.name']}" />
<p:inputText id="fieldName" value="#{playlistModel.playlist.plName}" label="FieldName"/>
<p:message for="fieldName" style="color:red" />
<h:outputText value="#{msg['table.playlist.column.header.default']}" />
<h:selectBooleanCheckbox value="#{playlistModel.playlist.defaultPl}"/>
</h:panelGrid>
<p:commandButton value="#{msg['modal.button.save']}" ajax="true" validateClient="true" update=":editForm" action="#{playlistModel.addPlaylist}" oncomplete="if (args && !args.validationFailed) PF('editPl').hide();"/>
<p:commandButton value="#{msg['modal.button.cancel']}" onclick="PF('editPl').hide();"/>
</h:form>
</p:dialog>
My class:
@ManagedBean(name="playlistModel")
@ViewScoped
public class PlaylistModel extends BaseModel implements Serializable{
private E_CMS_PL playlist;
.
.
.
}
My bean:
import javax.validation.constraints.Size;
@Entity
@Table(name="E_CMS_PL")
public class E_CMS_PL extends BaseEntity {
/** Name of the playlist */
@Column(name = "PL_NAME", unique=true ,length=64)
@Size(min=2,max=5)
private String plName;
.
.
.
}
When I click on save it just enter in the addPlaylist method, I also try to test it with a simple button like this: <p:commandButton value="test" ajax="false" validateClient="true"/>
but the input is still not validated. I did not understand why. Why is this not working?