This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes InputText Field - ValueChangeListener attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "InputText Field - ValueChangeListener attribute" Watch "InputText Field - ValueChangeListener attribute" New topic
Author

InputText Field - ValueChangeListener attribute

naveen gupta
Ranch Hand

Joined: Apr 12, 2006
Posts: 129
I am trying to do validation using regular expressions in my JSF backing bean using ValueChangeListener attribute for inputtext component

When i enter a value "2342342343" it does validation and shows error message
But when i edit the entered value by removing OR adding couple of integers, valuechangelistener is not invoked and no validation takes place
When i completely remove the entered value and reenter new value then validation takes place

Is there a way to do validation when the entered value is edited instead of completely re-entering new value


thanks in advance
Swetha Venkat
Greenhorn

Joined: Feb 14, 2011
Posts: 2

Hi,
Have you implemented valueChangeEvent and passing getNewValue() and getOldValue() correctly?
Alternately, Just see if you can use JSF validator Tag instead of using listeners
naveen gupta
Ranch Hand

Joined: Apr 12, 2006
Posts: 129
I figured it out.

First i tried JSF validator tag then thought it's not doing what i want then i tried ValueChangeListener. ( experimenting everything as i am new to JSF )

The whole problem was i have kept regular expressions in external properties file. And this property file was not read in the first case.

It's working fine now. thanks

SUGGESTION TO BEGINERS: keep as many LOG statements as you can
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: InputText Field - ValueChangeListener attribute
 
Similar Threads
InputText field validation based on DropDown value selected
valueChangeListener behavior
Attribute precedance in elements
valueChangeListener
question for h:inputText with struts tile 1.1