Re: Validate without submit?

2010-05-01 Thread Dale Newfield

On 5/1/10 11:58 AM, Ozu Natsu wrote:

I'm also puzzled why the JSONValidationInterceptor
validationAware.hasErrors() is always returning the entire validation
rule set.


Is params in the interceptor stack?
Are the arguments being passed?  (Look at the request from the client 
side with firefox.)  Are the arguments arriving at the server?  Are they 
being processed correctly?


-Dale

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-05-01 Thread Ozu Natsu
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().substring(6)
: fieldError.getKey());


My Action class is ModelDriven:
public class Myclass extends AdminSupport implements
ModelDriven, 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
parsing.

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
business?

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: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org