I was writing this issue with in mind that there are no comments in the scriptag produced by checkoff_head() (which is a problem for xhtml). Then I remembered the drupal_add_js() function; replace checkoff_head for:

[code]
drupal_add_js('function checkoff(form,toggle){var i=0;frm=document.forms[form];len=frm.elements.length;for(i=0;i [/code]

Comments

casey’s picture

hmm I used some some wrong markup.

drupal_add_js('function checkoff(form,toggle){var i=0;frm=document.forms[form];len=frm.elements.length; for(i=0;i<len;i++){if(frm.elements[i].type=="checkbox"){frm.elements[i].checked=toggle;}}}', 'inline');
casey’s picture

Oww, inline is an 5.0 feature.

then it should be this for 4.7:

function checkoff_head(){
return "<script type=\"text/javascript\"><!--function checkoff(form,toggle){ var i=0;	frm=document.forms[form];	len = frm.elements.length;	for( i=0 ; i<len ; i++) {	if (frm.elements[i].type=='checkbox') {	frm.elements[i].checked=toggle;	}	}} --></script>";
}
dww’s picture

can you attach a patch for this? http://drupal.org/diffandpatch

thanks!
-derek

casey’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.