1

I am working with primefaces 4.0.

I'm testing double combo example as is shown in http://www.primefaces.org/showcase/ui/pprSelect.jsf, because we have a similar requirement.

The example works very well, except when first selectOneMenu is required.

<p:selectOneMenu id="city" value="#{bean.city}" required="true">  
    <f:selectItem itemLabel="Select City" itemValue="" />  
    <f:selectItems value="#{bean.cities}" />  
    <p:ajax update="suburbs"  listener="#{bean.handleCityChange}"/>  
</p:selectOneMenu>

when city selectOneMenu is required and "Select City" is selected, selectOneMenu of suburbs remain with values of last valid city. Even handleCityChange() method isn't invoke by p:ajax...

Has anyone is having the same issue? Is there a way to clean the suburbs? We need the first selectOneMenu as required...

Thanks in advance

crvazquez
  • 7
  • 3
  • The question that best address this is this one: http://stackoverflow.com/questions/31624969/skip-validation-conditionally-when-empty-fselectitem-in-p-hselectonemenu-is-s – Fred Porciúncula Jan 22 '16 at 19:34

1 Answers1

0

try to use f:validateRequired for="city" instead of required="true"

Shekhar Khairnar
  • 2,643
  • 3
  • 26
  • 44
  • I have the same problem using f:validateRequired. – crvazquez Feb 05 '14 at 21:40
  • Currently i'm using immediate="true" in p:ajax to avoid validations, then, the problem was to get the submitted value, but we can get it using FacesContext and getting component by id. I'm still testing, not sure if it is the solution... – crvazquez Feb 05 '14 at 21:58
  • It could be bug see:- http://stackoverflow.com/questions/8351326/hselectonemenu-required-true-reverts-to-bean-value-on-validation-failure – Shekhar Khairnar Feb 06 '14 at 06:48