drupal_add_js() for inline script

casey - November 23, 2006 - 12:26
Project:Database Administration
Version:4.7.x-1.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

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

#1

casey - November 23, 2006 - 12:29

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');

#2

casey - November 23, 2006 - 12:33

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>";
}

#3

dww - December 7, 2006 - 09:34

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

thanks!
-derek

#4

casey - November 7, 2008 - 16:55
Status:active» fixed

--project followup subject--

System Message - November 21, 2008 - 17:13

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

--project followup subject--

System Message - November 21, 2008 - 17:25

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

#5

System Message - November 21, 2008 - 17:33
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.