Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 57193 invoked from network); 1 May 2010 15:58:57 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 1 May 2010 15:58:57 -0000 Received: (qmail 23182 invoked by uid 500); 1 May 2010 15:58:54 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 23131 invoked by uid 500); 1 May 2010 15:58:54 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 23123 invoked by uid 99); 1 May 2010 15:58:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 May 2010 15:58:54 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ozu.natsu@gmail.com designates 209.85.223.175 as permitted sender) Received: from [209.85.223.175] (HELO mail-iw0-f175.google.com) (209.85.223.175) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 May 2010 15:58:48 +0000 Received: by iwn5 with SMTP id 5so1455561iwn.9 for ; Sat, 01 May 2010 08:58:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=2FXoLxY7RSHZ1IGirFGFXVHgaFYxDnpPpzG4iQZgIVo=; b=CU7GAG5phiI3tDrPkxkBj9BxoCiGyzlbn3pulYo1v0k+Zwv/nA54IrH4sP31jv555s v/Y2ywG90GtrxrwEsgthkrZoFJZuqBR/7OFFm8MwgUu2TAz7A+tdt4fM6xKCxt9hklGS Ur740oV7/5GD461+WMS4FYt38fAjgq3H6tr4g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=wWoyjqJYgRGXOR/389Bd/6XGVP4mswI0ol7XkPKGWiDfQB9K3YdXaH+l3qSlts9hpu WkTDZZgooqOiFdWpHiU6dTizfRmB+I5oliSe31RHBxRZKCT1Mpg3XIdHe2Z5PEScT4zM O4qekbOvLbgN59DhjeXlWJXcxSzM3i8GiSQAU= MIME-Version: 1.0 Received: by 10.231.183.130 with SMTP id cg2mr4150777ibb.30.1272729507985; Sat, 01 May 2010 08:58:27 -0700 (PDT) Received: by 10.231.212.96 with HTTP; Sat, 1 May 2010 08:58:27 -0700 (PDT) In-Reply-To: References: <4BDB5FD7.1030407@Newfield.org> Date: Sat, 1 May 2010 10:58:27 -0500 Message-ID: Subject: Re: Validate without submit? From: Ozu Natsu To: Dale Newfield Cc: Struts Users Mailing List , Cimballi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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 eno= ugh? On Fri, Apr 30, 2010 at 6:34 PM, Ozu Natsu wrote: > Arg! > > Something else is going on. Maybe related to the parseError? =A0I 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. =A0Moreover, 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: >>> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0complete : function(XMLHttpRequest, text= Status){ >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0var form=3D $('#update')= [0]; >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//clear previous validat= ion errors, if any >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0StrutsUtils.clearValidationError= s(form); >>> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//get errors from response >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0var text =3D XMLHttpRequest.resp= onseText; >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0var errorsObject =3D StrutsUtils= .getValidationErrors(text); >>> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 //show errors, if any >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if(errorsObject.fieldErrors) { >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 StrutsUtils.showValidationE= rrors(form, errorsObject); >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} >>> >>> >>> On Fri, Apr 30, 2010 at 5:55 PM, Dale Newfield wrot= e: >>>> On 4/30/10 6:50 PM, Ozu Natsu wrote: >>>>> >>>>> Anyone have any ideas? >>>> >>>> Debugging from the client side: =A0Firebug in Firefox. >>>> Debugging from the server side: =A0log messages (log4j or other). >>>> >>>> -Dale >>>> >>> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org