Return-Path: Delivered-To: apmail-struts-dev-archive@www.apache.org Received: (qmail 51174 invoked from network); 26 Apr 2006 06:22:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 Apr 2006 06:22:31 -0000 Received: (qmail 9381 invoked by uid 500); 26 Apr 2006 06:17:12 -0000 Delivered-To: apmail-struts-dev-archive@struts.apache.org Received: (qmail 5137 invoked by uid 500); 26 Apr 2006 06:16:52 -0000 Mailing-List: contact dev-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Developers List" Reply-To: "Struts Developers List" Delivered-To: mailing list dev@struts.apache.org Received: (qmail 2488 invoked by uid 99); 26 Apr 2006 06:16:40 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Apr 2006 23:16:40 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Apr 2006 23:16:34 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 21452714309 for ; Wed, 26 Apr 2006 06:14:51 +0000 (GMT) Message-ID: <13538290.1146032091132.JavaMail.root@brutus> Date: Wed, 26 Apr 2006 06:14:51 +0000 (GMT+00:00) From: "Craig McClanahan (JIRA)" To: dev@struts.apache.org Subject: [jira] Moved: (SHALE-65) [Shale] client side commons validation not working inside a dataList MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/struts/browse/SHALE-65?page=all ] Craig McClanahan moved STR-2817 to SHALE-65: -------------------------------------------- Project: Shale (was: Struts Action 1) Key: SHALE-65 (was: STR-2817) Component: (was: Shale) Version: (was: Nightly Build) Assign To: (was: Struts Developer Mailing List) > [Shale] client side commons validation not working inside a dataList > -------------------------------------------------------------------- > > Key: SHALE-65 > URL: http://issues.apache.org/struts/browse/SHALE-65 > Project: Shale > Type: Bug > Environment: Operating System: All > Platform: All > Reporter: Paul Devine > Attachments: shale_debug.war > > Overview: > I was using Shale nightly build 20060328. See > http://www.mail-archive.com/user%40struts.apache.org/msg44124.html for pertinent > mailing list discussion. For inputs inside a dataList a row index is included in > the clientId to guarantee uniqueness on the html input id's. For example > "myForm:myDataList_0:someRequiredField" for the first row, > "myForm:myDataList_1:someRequiredField" for the second, and so on. But in > the rendering of the javascript by the struts validatorScript tag, the > clientId of the input components lose their row index. > To reproduce: > Deploy the jsp file whose source is included at the end of this description into > a minimal myfaces web-app. Drop into WEB-INF/lib the shale-core dependency files > and a myfaces-1.1.1 "all" jar. > Start the web-app and open http://localhost:8080/shale_debug/index.jsf. Do a > view source on the html and you will see two fields with their id's > "someForm:someDataList_0:someRequiredField" and > "someForm:someDataList_0:someRequiredField". But in the validation javascript > function required() you'll see only one input > "someForm:someDataList:someRequiredField". If you submit the form without > filling out the required fields you will notice that a javascript error occurs > causing client side validation to be skipped. The server-side validation works ok. > The full list of jars you need in WEB-INF/lib is : > commons-beanutils.jar, commons-chain.jar,commons-codec-1.3.jar, > commons-digester.jar, commons-fileupload.jar, commons-logging.jar, > commons-validator.jar, shale-core.jar, myfaces-all-1.1.1.jar > > ================================== > The source for the index.jsp is as follows: > ================================== > <%@ page language="java" > import="java.util.*,org.apache.shale.dialog.impl.DialogImpl"%> > <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> > <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> > <%@ taglib uri="http://myfaces.apache.org/extensions" prefix="t"%> > <%@ taglib uri="http://struts.apache.org/shale/core" prefix="s" %> > <% > /* Put a couple of Shale DialogImpl objects into the session (we just need an > object with a getter and a setter > * and this class is readily accessible) > */ > List inputObjects = new ArrayList(); > inputObjects.add(new DialogImpl()); > inputObjects.add(new DialogImpl()); > session.setAttribute("someInputObjects",inputObjects); > %> > > <%-- > A form with a dataList of inputs. The client side id's of the components will be > someForm:someDataList_0:someRequiredField and > someForm:someDataList_1:someRequiredField > --%> > > rowIndexVar="index"> > > required="true"> > > > > <%-- > The dataList is now closed. Before we close out the form, write out the > validator javascript. But > this results in a mismatch on the client side id's in the required function. > Note the uniqueness > indexes _0 and _1 are missing. Because we are outside the > dataList there is no "row index" anymore (and for some reason the HtmlInputText > components `calculate` > their clientId's again when asked for getClientId from Shale's ValidatorScript > findCommonsValidators method > Here's what the validatorScript comes up with:- > function required() { > this[0] = new Array("someForm:someDataList:someRequiredField", "Name is > required.", new Function("x", "return {}[x];")); > } > --%> > > > > -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org For additional commands, e-mail: dev-help@struts.apache.org