File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » JSF
Bookmark "InputText Field - ValueChangeListener attribute" Watch "InputText Field - ValueChangeListener attribute" New topic

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

Joined: Feb 14, 2011
Posts: 2

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:
subject: InputText Field - ValueChangeListener attribute
It's not a secret anymore!