Download & Extend

double quotes in forms attributes are converting to &quote;

Project:PHPTemplate
Version:master
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

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.

Comments

#1

So what's the solution to this?

thanks

Bagus

#2

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

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

#4

Just use single quotes for upload form.

document.getElementById('uploadform')... this should work!

nobody click here