I am trying to update the watermark messages dynamically based on the selected values from jsf selectOneMenu.The id being used for watermark component is “waterMark1”.
The watermark component is linked to an input text field.
On valueChange , i get an error message that the id waterMarkID1 could not be located.
I tried updating an outputText based on the selectOneMenu selection and kept the id as WatermarkID1.It works fine with the outputText.
Is there any way to display the watermark messages based on the bean values.Any help would be appreciated.
<h:selectOneMenu value="#{RequestBean.searchonType}" valueChangeListener="# {RequestBean.getValidateMsg}" id="searchUser">
<f:selectItems value="#{RequestBean.searchonTypeList}" />
<f:ajax event="change" update="waterMarkID1" render="waterMarkID1"/>
</h:selectOneMenu>
<h:inputText id="searchTxt" styleClass="text_small" size="50" value="#{RequestBean.searchTxt}"/>
<p:watermark id="waterMarkID1" for="searchTxt" value="#{RequestBean.waterMarkID}"/>
It seems that you can’t update the
p:watermarkcomponent directly. However, updating the container which holds that component will update your watermark message too:Note that you can reduce the elements enclosed by the
p:panel, for example, toh:inputTextandp:watermarkonly. The key is to update the container, not the watermark component.