You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by aw...@apache.org on 2007/10/13 22:41:46 UTC
svn commit: r584451 - in
/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main:
java/org/apache/myfaces/trinidadinternal/io/ javascript/META-INF/adf/jsLibs/
Author: awiner
Date: Sat Oct 13 13:41:45 2007
New Revision: 584451
URL: http://svn.apache.org/viewvc?rev=584451&view=rev
Log:
TRINIDAD-713: Using "name" as the id for a component breaks form submission. "name" appears to be an undocumented reserved identifier.
- Incorporated patch from Leonardo Uribe, with modifications; also fixed references to
form.name in Shuttle and PPR code
- Removed warning from debug ResponseWriter that had been warning developers that "name" was not supported
Modified:
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/DebugHtmlResponseWriter.java
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PPR.js
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Shuttle.js
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/DebugHtmlResponseWriter.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/DebugHtmlResponseWriter.java?rev=584451&r1=584450&r2=584451&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/DebugHtmlResponseWriter.java (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/DebugHtmlResponseWriter.java Sat Oct 13 13:41:45 2007
@@ -136,13 +136,6 @@
if (!"a".equals(_elementStack.peek()))
_LOG.warning("Illegal character (space) in \"name\" attribute");
}
- // =-=AEW. Some browsers are very unhappy when the "name"
- // attribute is set to "name" itself; we have gotten many emails and bugs
- // from people who make this mistake.
- else if ("name".equals(value))
- {
- _LOG.warning("\"name\" attribute incorrectly set to \"name\"");
- }
// And "target" causes problems too - see bug 2693457
else if ("target".equals(value))
{
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js?rev=584451&r1=584450&r2=584451&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js Sat Oct 13 13:41:45 2007
@@ -1126,6 +1126,26 @@
return name.split(':').join('_');
}
+function _getFormName(form)
+{
+ var name = form.name;
+
+ if ((typeof name) != 'string')
+ {
+ if (_agent.isIE)
+ {
+ name = form.attributes['name'].nodeValue;
+ }
+ else
+ {
+ name = form.getAttribute('name');
+ }
+ }
+
+ return name;
+}
+
+
/**
* Calls the correct validations function for the form and returns true
* if the validation succeeded.
@@ -1135,7 +1155,7 @@
source
)
{
- var funcName = '_' + _getJavascriptId(form.name) + 'Validator';
+ var funcName = '_' + _getJavascriptId(_getFormName(form)) + 'Validator';
var formWind = window[funcName];
if (formWind)
return formWind(form, source);
@@ -1573,7 +1593,7 @@
// validated, so there is no real validator, we've just hacked one. The
// submit always sets doValidate to false. Just make sure that you never use
// this validator if doValidate is false (it might just be the value '1').
- var formComplete = window["_"+ _getJavascriptId(form.name) + "Validator"];
+ var formComplete = window["_"+ _getJavascriptId(_getFormName(form)) + "Validator"];
if (formComplete == (void 0))
{
@@ -1625,7 +1645,7 @@
//
// If we have an onSubmit handler, call it
//
- var onSubmit = window["_" + _getJavascriptId(form.name) + "_Submit"];
+ var onSubmit = window["_" + _getJavascriptId(_getFormName(form)) + "_Submit"];
if (onSubmit != (void 0))
{
@@ -2214,7 +2234,7 @@
}
// And store the new validator map away
- window["_" + _getJavascriptId(form.name) + "_Validators"] = validatorMap;
+ window["_" + _getJavascriptId(_getFormName(form)) + "_Validators"] = validatorMap;
}
/**
@@ -2232,7 +2252,7 @@
// Initialise the return map.
var failureMap = new Object();
- var subforms = window[form.name + "_SF"];
+ var subforms = window[_getFormName(form) + "_SF"];
var ignorePrefixes = new Array();
var foundUsedSubform = false;
var key;
@@ -2748,7 +2768,7 @@
form
)
{
- return window["_" + _getJavascriptId(form.name) + "_Validators"];
+ return window["_" + _getJavascriptId(_getFormName(form)) + "_Validators"];
}
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PPR.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PPR.js?rev=584451&r1=584450&r2=584451&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PPR.js (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PPR.js Sat Oct 13 13:41:45 2007
@@ -638,7 +638,7 @@
if (sourceForm.hasChildNodes())
{
// Get the source form's name and action
- var sourceName = sourceForm.name;
+ var sourceName = _getFormName(sourceForm);
var sourceAction = sourceForm.action;
// Locate the target form
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Shuttle.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Shuttle.js?rev=584451&r1=584450&r2=584451&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Shuttle.js (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Shuttle.js Sat Oct 13 13:41:45 2007
@@ -63,7 +63,7 @@
{
if (document.forms[i][listName] != (void 0))
{
- this.formName = document.forms[i].name;
+ this.formName = _getFormName(document.forms[i]);
break;
}
}
@@ -1291,7 +1291,7 @@
{
if (document.forms[i][element] != (void 0))
{
- return document.forms[i].name;
+ return _getFormName(document.forms[i]);
}
}
return "";