When I was playing with widgets, I saw that current version of pageform.pt javascript did not work properly in IE ver 6...something ;), not actually matters (but worked fine in FF and Opera).

When I changed a few lines, now it works for my IE (6.sth), FF ( and Opera(9.01) versions.
Please check if it is a proper solution to metnioned bug(?).
I'm not able to change it in svn, so if it's OK maybe someone else ought to do that, please? :)

Here is the code:
<script type="text/javascript">
function toggleFormFieldHelp(ob,state) {
 // ob is the label element
 var field = findWidgetDiv(ob);
 if (field) {
   field.style.visibility = state && 'hidden' || 'visible';
   var help = document.getElementById("field-help-for-" + ob.htmlFor);
   if (help) {
     help.style.visibility = state && 'visible' || 'hidden';

function findWidgetDiv(label) {
 var element = findFormField(label);
 while (element) {
     element = element.parentNode;
if (element.tagName && element.className && element.tagName == 'DIV' && element.className == 'widget')
       return element;

function findFormField(label) {
 var name = label.htmlFor;
 var field = label.form[name];
 // Multiple fields with the same name, such as radiobuttons
 if (field) {
   if (field.length)
     field = field[0];
   return field; //znalazl i wszytsko jest OK
 // No field with the exact name; find one that starts with the name
 for (var i = 0; field = label.form[i++];) {
   if (field.name && field.name.substr(0, name.length) == name)
     return field;
// -->

If I can comment a little:
a) as I've read somewhere, it's better to get 'class' atribute directly rather than by getAttribute method, and it seems to help in my case, b) checking if some attribute's value is not null prevents, I think, problems in IE.


Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to