This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JSF and the fly likes JSF:validating primefaces selectOneMenu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF:validating primefaces selectOneMenu" Watch "JSF:validating primefaces selectOneMenu" New topic

JSF:validating primefaces selectOneMenu

prashant kumar g

Joined: Jun 11, 2013
Posts: 1

I'm hoping someone can help me.
i am not able to validate select box.
<p:message for="interests" />

<h:outputLabel value="Select one value" />

<p:selectOneMenu value="#{testBean.selectedItem}" validatorMessage="required" id="qly">

<f:selectItem itemValue="?" itemLabel="--Select--" />
<f:selectItems value="#{testBean.selectItems}" />
<f:validateRegex pattern="[^?]" summaryMessage="please provide appropriate value"></f:validateRegex>
<p:message for="qly" />
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15632

Normally we'd admonish you to give more information. "It doesn't work" doesn't tell us anything.

But I am totally puzzled by your use of a regex validator on a dropdown selection list. When the choices you can make are limited by what's in the list, using regexes to validate them doesn't make any sense. :confused:

Customer surveys are for companies who didn't pay proper attention to begin with.
I agree. Here's the link:
subject: JSF:validating primefaces selectOneMenu
Similar Threads
"Fake" Dynamic Field to Form [using rendered]
multiple form in xhtml page nad update different controlls on two different forms
problem with header height in primefaces tabview
Updating a form in primefaces when a selection is made in the datatable