Detecting when inputText field has been cleared
posted 5 months ago
Hi, I have a validator tag in a Seam form that validates values entered on an h:inputText field. It validates fine if the user enters numbers, but if they simply clear out whatever value is in the field and leave it blank (which is fine, that should pass validation) I can't seem to find a way to capture that action. I know one possible solution could be to attach a listener to the field, but there are several of these other fields on the form and, to be honest, it would add a lot of extra code (hope that doesn't sound like an excuse for not following that option). I tried putting System.out.println statements inside the validate method in the bean to try and determine what happens specifically to the field I am working with, but resetting an input field to blank doesn't seem to "register" at all in the validator method. Would anyone have any ideas on how to resolve that? My apologies for not providing code, I just wanted to see if there were other options I hadn't considered before getting into code snippets. I am using Eclipse Kepler J2EE, JDJ 1.7, JBoss 4.2.2 GA, Seam 2.2. Any suggestions would be greatly appreciated. Thank you!