struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ozu Natsu <>
Subject Re: Validate without submit?
Date Sat, 01 May 2010 15:58:27 GMT
Anyone following this thread -- here's where I am at:

The struts JSONValidationInterceptor seems to be munching the name of
the field to be validated at line 149/150:
                    sb.append(validationAware instanceof ModelDriven ?
                            : fieldError.getKey());

My Action class is ModelDriven:
public class Myclass extends AdminSupport implements
		ModelDriven<MyBizObject>, Preparable, UserAware {

I'm not sure why it is doing a substring(6) of the fieldError.getKey
--  but if I comment that out and use just the fieldError.getKey()
value, the JSON result gets sent back to the ajax "complete" callback.
 The textResult of the "callback" is still "parseerror", but it has a
valid response that can be passed to the StrutsUtils object for

I'm also puzzled why the JSONValidationInterceptor
validationAware.hasErrors() is always returning the entire validation
rule set.  In other words, it is not seeing fields with valid values
vs. fields with invalid values.  I'm wondering if the validation
interceptor is also not finding the fields to validate and matching
them with the validation rules because of this fieldError key

Struts Experts, what happing here??  I am I describing the problem well enough?

On Fri, Apr 30, 2010 at 6:34 PM, Ozu Natsu <> wrote:
> Arg!
> Something else is going on. Maybe related to the parseError?  I am
> assuming the callback should be on the success function, not the
> error/complete.
> I replaced the jquery $('update')[0] reference with document.forms[0]
> and I get the exact same thing.  Moreover, it looks as if the
> errorsObect.fieldErrors has ALL my validations in it, regardless of
> whether the field had a value or not.
> On Fri, Apr 30, 2010 at 6:20 PM, Ozu Natsu <> wrote:
>> The problem looks as if it is in the DOM, I'm wondering if this isn't
>> jquery's fault?
>> All of the field names in the form.elements are somehow mangled.
>> "artNumber" instead of "partNumber"
>> On Fri, Apr 30, 2010 at 6:14 PM, Ozu Natsu <> wrote:
>>> Dale,
>>> So close! I am now to the point where I am getting the errors, but
>>> when I try to use the struts utilities to display them, I am getting
>>> an undefined object in the struts validation.js function
>>> addErrorXHTML(e, errorText) ;
>>> My code looks like this:
>>>                complete : function(XMLHttpRequest, textStatus){
>>>                        var form= $('#update')[0];
>>>                        //clear previous validation errors, if any
>>>                    StrutsUtils.clearValidationErrors(form);
>>>                    //get errors from response
>>>                    var text = XMLHttpRequest.responseText;
>>>                    var errorsObject = StrutsUtils.getValidationErrors(text);
>>>                     //show errors, if any
>>>                    if(errorsObject.fieldErrors) {
>>>                       StrutsUtils.showValidationErrors(form, errorsObject);
>>>                    }
>>>                }
>>> On Fri, Apr 30, 2010 at 5:55 PM, Dale Newfield <> wrote:
>>>> On 4/30/10 6:50 PM, Ozu Natsu wrote:
>>>>> Anyone have any ideas?
>>>> Debugging from the client side:  Firebug in Firefox.
>>>> Debugging from the server side:  log messages (log4j or other).
>>>> -Dale

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message