ASF Bugzilla – Attachment 11676 Details for
Bug 29223
[PROPOSAL] Tag turns a collection into a javascript function to populate select.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Javascript to find a field in an html form.
Struts_eval.js (text/plain), 2.01 KB, created by
Edgar Dollin
on 2004-05-26 11:58:35 UTC
(
hide
)
Description:
Javascript to find a field in an html form.
Filename:
MIME Type:
Creator:
Edgar Dollin
Created:
2004-05-26 11:58:35 UTC
Size:
2.01 KB
patch
obsolete
>// determine a field from it's name >function Struts_eval(fieldName, fieldCount, docObject) { > > var objWrk = null; > if (fieldName == null) > return objWrk; > > if (docObject == null) > docObject = document; > > var fieldNameWrk = null; > > if (docObject.getElementsByName != null) { > > if (fieldCount == null || fieldCount == 0) { > fieldNameWrk = fieldName; > var fields = docObject.getElementsByName(fieldNameWrk); > field = fields[0]; > if (field) > return field; > } > > if (fieldCount != null) { > fieldNameWrk = fieldName + '[' + fieldCount + ']'; > var fields = docObject.getElementsByName(fieldNameWrk); > field = fields[0]; > if (field) > return field; > } > } > > if (fieldCount == null) > fieldCount = 1; > > // now try the rediculous eval > var findCount = 0; > var len; > for ( var i = 0; i < docObject.forms.length; i++ ) { > for (var j = 0; j < docObject.forms[i].elements.length; j++) { > //alert("triing " + docObject.forms[i].elements[j].name + " vs " + fieldName + " findCount:" + findCount + " fieldCount:" + fieldCount); > if (docObject.forms[i].elements[j].name == fieldName) { > if (++findCount == fieldCount) { > objWrk = docObject.forms[i].elements[j]; > //alert("found object " + objWrk.name); > return objWrk; > } > } > fieldNameWrk = "." + fieldName; > len = docObject.forms[i].elements[j].name.indexOf(fieldNameWrk); > if (len <= 0) > continue; > if (len + 1 + fieldName.length == docObject.forms[i].elements[j].name.length) { > if (++findCount == fieldCount) { > objWrk = docObject.forms[i].elements[j]; > //alert("found object " + objWrk.name); > return objWrk; > } > } > } > } > > //alert("object not found "); > return objWrk; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 29223
:
11675
| 11676 |
11777