struts validation problem in IE

Posted by user265201 on Stack Overflow See other posts from Stack Overflow or by user265201
Published on 2010-04-01T15:08:04Z Indexed on 2010/04/01 15:23 UTC
Read the original article Hit count: 311

Filed under:
|
|

I am using Struts 2.1.8 and facing validation problem in IE. I am getting the following error

An exception occurred: Error. Error message: Invalid argument. 

I tried out to figure out the cause and found the following. My generated javascript code is:

field = form.elements['district.name'];  
var error = "Enter only alphabets for district";  
if (continueValidation && field.value != null && !field.value.match("^[a-zA-Z ]*$")) {  
    addError(field, error);  
    errors = true;  
}  

I tried to mock up by putting the same code in a function and calling it in onclick event. The method addError() throws the exception and the reason is field variable. If I change it to field[0], it works fine. How to fix this error?

© Stack Overflow or respective owner

Related posts about java

Related posts about struts