Hi,
I have a <p:selectOneRadio> where the user needs to select one of the proposed values defined by the <f:selectItems>. However, adding the attribute required="true" doesn't trigger a validation error.
<p:selectOneRadio value="#{simulator.simulationData.investmentPortfolio}"
id="investmentPortfolio" required="true" requiredMessage="#{messages.error_portfolio_required}"
layout="pageDirection">
<f:selectItems value="#{data.investmentPortfolioList}" var="investmentPortfolio"
itemLabel="#{e:retrieveLabel(investmentPortfolio)}"
itemValue="#{investmentPortfolio}"/>
</p:selectOneRadio>
When the users submits the page with the above tag on, the error message error_portfolio_required isn't shown.
The problem is situated in the method org.primefaces.component.selectoneradio.SelectOneRadioRenderer#decode where the value null is set when no selection is made.
Later on, the validation isn't performed because the value of the component is null.
The method org.primefaces.component.selectoneradio.SelectOneRadioRenderer#decode should place an empty string ("") when it doesn't find the data in the request map.
Workaround:
Extend the renderer and fix the decode method. This new renderer then needs to be registered in faces config file.
Best regards,
Rudy De Busscher
http://www.c4j.be
Required not working with SelectOneRadio in 3.0.M4
PrimeFaces version 3.5, Tomcat 7, Mojarra 2.1.13
PrimeFaces version 4.0, Glassfish 4.0
PrimeFaces version 5.0, WLS 12.1.2
If you haven't read the forum rules read them now : viewtopic.php?f=3&t=1194
PrimeFaces version 4.0, Glassfish 4.0
PrimeFaces version 5.0, WLS 12.1.2
If you haven't read the forum rules read them now : viewtopic.php?f=3&t=1194
-
- Information
-
Who is online
Users browsing this forum: No registered users and 24 guests