I have a custom dialog which lets a user select a page from a drop down list to insert a link into their page. The code segments look like this:
Now my dropdown list works fine, and I can return the ID into the page fine, but the "&" in my URL gets pasted as & which obviously wont work in a URL.
How can i get the ampersand to paste directly as a "&" ?
onOk:function(){
var mySelection = e.getSelection();
if (CKEDITOR.env.ie) {
mySelection.unlock(true);
var selectedText = mySelection.getNative().createRange().text;
} else {
var selectedText = mySelection.getNative();
}
var pageID=this.getValueOf('info','selectPage');
sInsert = "<a href='home.php?page=page&id="+pageID+"'>"+selectedText+"</a>";
e.insertHtml(sInsert);
},
contents:[
{ id:"info",
name:'info',
label:'Link to Page',
elements:[{
type:'vbox',
padding:0,
children:[
{ type:'select',
id:'selectPage',
label:'Select Page:',
items:[<?php
$i = 1;
while($row = mysql_fetch_assoc($result))
{
if($i == 1) {
echo "['".$row['title']."','".$row['id']."']";
$i = 5;
}
else
echo ",['".$row['title']."','".$row['id']."']";
}
?>]
Now my dropdown list works fine, and I can return the ID into the page fine, but the "&" in my URL gets pasted as & which obviously wont work in a URL.
How can i get the ampersand to paste directly as a "&" ?
