I have a jsp form in a struts2 application , which has few strtus2 tag text fields and a submit button .
When i hit the submit button with out enterning the values in the textfields i get a error messages for the required fields saying that the " value is required "
validation is not a problem .. but once i enter the value in the textbox and move to the next textbox ,first fields error msg should disappear , i know this has to be done using ajax but how should i do that ?
Are you using Ajax validation? If you're not, then dynamically modifying the DOM to remove static error messages has nothing to do with Ajax. If you are, the simplest solution might just be to re-submit the form for validation.
Are you using client-side validation? If you're not, then this is more trouble than it's worth. If you are, then perhaps just setting up some onblur handlers and re-calling the validation would be the easiest way.
Joined: Jun 14, 2010
I am validating my Form Fields using the <actionclassname>-validation.xml which calls by itself when i submit the form .I dont think this is an ajax validation.
If you're not using Ajax or client-side validation in the first place then I don't really think this is a reasonable requirement, because the field hasn't been re-validated yet. That aside, use an onblur to clear the associated error message; I think it's in a span. I'm not sure what the current state of the generated HTML is; you might have to resort to some minor DOM traversal to find it unless you extend a theme to produce more semantic markup.