dgraham 2002/12/12 18:36:47
Modified: src/share/org/apache/struts/taglib/html FormTag.java
Log:
formatting changes, no code changes.
Revision Changes Path
1.40 +22 -20
jakarta-struts/src/share/org/apache/struts/taglib/html/FormTag.java
Index: FormTag.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/FormTag.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- FormTag.java 13 Dec 2002 02:26:24 -0000 1.39
+++ FormTag.java 13 Dec 2002 02:36:47 -0000 1.40
@@ -112,12 +112,13 @@
* The name of the field to receive focus, if any.
*/
protected String focus = null;
-
+
/**
* The index in the focus field array to receive focus. This only applies if
the field
* given in the focus attribute is actually an array of fields. This allows a
specific
* field in a radio button array to receive focus while still allowing indexed
field
* names like "myRadioButtonField[1]" to be passed in the focus attribute.
+ * @since Struts 1.1
*/
protected String focusIndex = null;
@@ -624,31 +625,32 @@
if (this.focus != null) {
results.append("\r\n");
results.append(this.getJsStartElement());
-
+
// xhtml script content shouldn't use the browser hiding trick
if (!this.isXhtml()) {
results.append(" <!--\r\n");
- }
-
+ }
+
// Construct the control name that will receive focus.
// This does not include any index.
- String focusControl =
"document.forms[\""+beanName+"\"].elements[\""+this.focus+"\"]";
-
- results.append(" var focusControl = " + focusControl+";\r\n\r\n");
-
+ String focusControl =
+ "document.forms[\"" + beanName + "\"].elements[\"" + this.focus +
"\"]";
+
+ results.append(" var focusControl = " + focusControl + ";\r\n\r\n");
+
results.append(" if (focusControl.type != \"hidden\") {\r\n");
// Construct the index if needed and insert into focus statement
String index = "";
- if(this.focusIndex != null){
- index="["+this.focusIndex+"]";
+ if (this.focusIndex != null) {
+ index = "[" + this.focusIndex + "]";
}
results.append(" focusControl" + index + ".focus();\r\n } \r\n");
-
- if (!this.isXhtml()) {
+
+ if (!this.isXhtml()) {
results.append(" // -->\r\n");
}
-
+
results.append("</script>\r\n");
}
@@ -837,7 +839,7 @@
*/
private String getJsStartElement() {
String start = "<script type=\"text/javascript\"";
-
+
if (!this.isXhtml()) {
start += " language=\"JavaScript\"";
}
@@ -845,7 +847,7 @@
return start;
}
-
+
/**
* Returns true if this tag should render as xhtml.
*/
@@ -855,7 +857,7 @@
return ("true".equalsIgnoreCase(xhtml));
}
-
+
/**
* Returns the focusIndex.
* @return String
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>