You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2006/03/30 18:09:49 UTC
DO NOT REPLY [Bug 39156] New: - [Shale] client side commons validation not working inside a dataList
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39156>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39156
Summary: [Shale] client side commons validation not working
inside a dataList
Product: Struts
Version: Nightly Build
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Shale
AssignedTo: dev@struts.apache.org
ReportedBy: devinesy@gmail.com
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 <input> 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);
%>
<f:view>
<%--
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
--%>
<h:form id="someForm" onsubmit="return validateForm(this);">
<t:dataList id="someDataList" value="#{someInputObjects}" var="object"
rowIndexVar="index">
<h:outputLabel value="Name"/>
<h:inputText id="someRequiredField" value="#{object.name}" size="20"
required="true">
<s:commonsValidator type="required" arg="Name" server="true" client="true"/>
</h:inputText><h:message for="someRequiredField" errorClass="errorMessage"/>
</t:dataList>
<%--
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];"));
}
--%>
<s:validatorScript functionName="validateForm"/>
<h:commandButton action="submit"/>
</h:form>
</f:view>
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
DO NOT REPLY [Bug 39156] - [Shale] client side commons validation not working inside a dataList
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39156>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39156
------- Additional Comments From devinesy@gmail.com 2006-03-30 17:15 -------
Created an attachment (id=18006)
--> (http://issues.apache.org/bugzilla/attachment.cgi?id=18006&action=view)
"war" file to be deployed in tomcat
This is a skeleton war file ready to br dropped into tomcat that reproduces the
problem. It includes the jsp and configuration files but you would need to drop
in the WEB-INF/lib files as detailed in the issue description.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
DO NOT REPLY [Bug 39156] - [Shale] client side commons validation not working inside a dataList
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39156>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39156
gvanmatre@comcast.net changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From gvanmatre@comcast.net 2006-04-06 04:00 -------
A patch was applied in the 20060406 nightly build. This bug shares
implementation strategy with 37932.
http://issues.apache.org/bugzilla/show_bug.cgi?id=37932
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
DO NOT REPLY [Bug 39156] - [Shale] client side commons validation not working inside a dataList
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39156>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39156
------- Additional Comments From mkienenb@gmail.com 2006-03-30 17:16 -------
Try upgrading to the latest myfaces snapshot.
There were issues fixed in the last month or so dealing with input components
inside a dataList.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org