double quotes in forms attributes are converting to &quote;

raj_m28 - December 8, 2007 - 06:18
Project:PHPTemplate
Version:HEAD
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi,

I am creating a new node form, in which I am adding a button. I am trying to add an attribute to this button, which is an onClick property. It is shown below.

'#attributes' => array('onClick' => 'checkimg(document.getElementById("uploadform")); return false;')

But when I view the html code that is generated the double quotes are convering to ". I tried many ways like the following.

1)
$var = 'checkimg(document.getElementById("uploadform")); return false;';
'#attributes' => array('onClick' => $var)

2)
$var = "checkimg(document.getElementById('uploadform')); return false;";
'#attributes' => array('onClick' => $var)

But nothing worked.

Can you please let me know how to add double quotes in the above example.

Thank you,
Raj.

#1

bagusbean - March 10, 2009 - 18:58

So what's the solution to this?

thanks

Bagus

#2

mk31762 - May 18, 2009 - 12:14

Yes, I'd like to know, too. I just spent the better part of an hour trying to get my search terms just right. Finally I found a post describing the exact problem I am having and...no answer. Always the way.

#3

SlyK - October 3, 2009 - 19:40

I got the same problem... are solutions found?

 
 

Drupal is a registered trademark of Dries Buytaert.