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
Comment #1
bagusbean commentedSo what's the solution to this?
thanks
Bagus
Comment #2
mk31762 commentedYes, 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.
Comment #3
SlyK commentedI got the same problem... are solutions found?
Comment #4
maumad commentedJust use single quotes for upload form.
document.getElementById('uploadform')... this should work!