Closed (won't fix)
Project:
Drupal core
Version:
4.7.3
Component:
forms system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Aug 2006 at 16:05 UTC
Updated:
10 Sep 2006 at 21:03 UTC
$form['category'] = array(
'#type' => 'select',
'#name' => $formname,
'#id' => $formname,
'#title' => '',
'#default_value' => '',
'#options' => $options,
'#description' => '',
'#multiple' => $multiple = FALSE,
'#required' => $required = FALSE,
'#attributes' => array('onChange' => "top.location.href=document.getElementById('$formname').options[document.getElementById('$formname').selectedIndex].value"),
);
return -->
<select name="" onChange="top.location.href=document.getElementById( #039; #039;).options[document.getElementById( ' ').selectedIndex].value" class="form-select" id="">
also i try
#attributes' => array('onChange' => "top.location.href=document.getElementById(\'$formname\').options[document.getElementById(\'$formname\').selectedIndex].value")
but nothing
Comments
Comment #1
hasiotis commentedI don't know it this is a drupal 4.7 only issue but I found that if you change the following on bootstrap.inc:
to
it works. But I don't even know if this is a bug or a feature ;-)
Comment #2
nsyll commentedIts work, but realy what is it ? Bug or a feature
Comment #3
heine commentedAs far as I know, the generated javascript simply works. Is that what you allude to with
If so it certainly isn't critical.
Comment #4
beginner commentedThis bug causes that other one: http://drupal.org/node/70742 (Problems with apostrophe in file name)
Comment #5
yched commented@beginner : This is in fact a separate issue
Comment #6
beginner commentedyched's patch http://drupal.org/node/83297 has been committed to HEAD.
Please test again this issue with HEAD.
(check the mentioned issue to see if it's been backported to 4.7)
Comment #7
yched commentedThe patch http://drupal.org/node/83297 only involved upload.module display, so there's no chance it affected this issue.
'#attributes' do get passed through check_plain, (in function drupal_attributes). This is probably a good thing, but this messes with single quotes, which is problematic for JS code.
It does not seem like we can remove the ENT_QUOTE from check_plain either, There has been an attempt at it (http://drupal.org/node/29103), it even got committed, but Dries rolled it back for security concerns.
I guess adding such JS attributes is much easier now in 5.0 (new drupal_*_js functions, jQuery)
Maybe there"s a workaround here too ?
Comment #8
Steven commentedHTML entities are semantically equivalent to the represented character (in those cases where the literal character has no special meaning). Embedded JavaScript code works just as well whether it is escaped or not.