[Zope] JavaScript help!
Spicklemire, Jerry
Jerry.Spicklemire@IFLYATA.COM
Wed, 7 Feb 2001 14:09:17 -0500
Hi Peter,
This is way too late, but in case you haven't resolved the problem with
names of some HTML page elements, with colons (e.g. "name='data:text'"),
the cleanest way to get around this is to retrieve the corresponding
positional value of the 'elements' array of the form, and then refer to
it's contents as:
document.elements[array_position].value
Now, how do you see the elements array values? One of our Javascript gurus
solved that with:
function el_count (form_name) {
var newWin = window.open("","","resizable=yes, toolbar, scrollbars,
status, height=400, width=600");
var msg = '<html><body><p><table
border="1"><tr><th>element</th><th>Name</th><th>Value</th><th>Description</t
h><th>Mandatory</th></tr>';
for (var i = 0; i < g.elements.length; i++) {
msg = msg + '<tr><td>' + i + '</td><td>' +
g.elements[i].name +
'</td><td>' + g.elements[i].value + '</td>';
if (g.elements[i].desc > '')
msg = msg + '<td>' + g.elements[i].desc + '</td>';
else
msg = msg + '<td> </td>';
if ((g.elements[i].mand) || (! g.elements[i].opt))
msg = msg + '<td>Yes</td>';
else
msg = msg + '<td> </td>';
msg = msg + '</tr>';
}
msg = msg + '</table></p></body></html>';
newWin.document.write (msg);
// document.write (msg);
}
Place this in the <head> section of your page while debugging.
Just keep in mind that if you add any new elements on the page,
above the element you have to refer to by it's array position,
you will need to update the value to match it's new position.
I was scanning the lists for Javascript tips, and saw that you
only got one reply, and it was very different from this one.
Later,
Jerry S.