• Home
  • Contact Me
  • About Me
  • Resources
  • Favorites
  • Earn Money

Thursday, September 11, 2008

JSF: Handling onchange event with input mask

Problem:
onchange event is NOT working when we use mask on a text field with Input Assistance enable in java server faces (jsf).
Example: Following jsp code sample will illustrate the problem.

onchange is very important if we want to see if a particular form is got changed.

Solution:
One possible solution is to use hidden variable which will hold the same value as the phone number field initially.
Any change in the value of phone number field will not affect the hidden field. That means hidden variable will hold the old value. Any difference between the two means the field got changed.

Example:


1 comment:

Venkat said...

This works fine.