Problem writing single quote into macro input boxes. Options
mchung
Posted: Wednesday, August 16, 2006 3:57:49 PM
Rank: Enthusiast

Joined: 8/3/2006
Posts: 24
I'm having a problem where I can't write the single quote character (' or ASCII ') into a macro input box (text or textMultiLine).

I get a javascript error upon updating the macro:

Line 89
Char: 251
Error: Expected ')'
URL: http://mysite/umbraco/dialogs/editMacro.aspx?mode=edit etc... etc...

Not sure what to do :-| something to do with the character not being escaped properly?
kolchak
Posted: Thursday, August 17, 2006 2:39:54 AM
Rank: Enthusiast

Joined: 8/15/2006
Posts: 17
Location: Melbourne, Australia
Can u pls paste the JavaScript from the page source? I saw this in the Media section too so was going to do a patch once 2.1.5 source is avail...
mchung
Posted: Thursday, August 17, 2006 10:24:48 AM
Rank: Enthusiast

Joined: 8/3/2006
Posts: 24
function saveTreepickerValue(appAlias, macroAlias) {
var treePicker = window.showModalDialog('treePicker.aspx?appAlias=' + appAlias, 'treePicker', 'dialogWidth=350px;dialogHeight=300px;scrollbars=no;center=yes;border=thin;help=no;status=no')
document.forms[0][macroAlias].value = treePicker;
document.getElementById("label" + macroAlias).innerHTML = "</b><i>updated with id: " + treePicker + "</i><b><br/>";
}

var macroAliases = new Array();

function registerAlias(alias) {
macroAliases[macroAliases.length] = alias;
}

function updateMacro() {
var macroString = '';

for (i=0; i<macroAliases.length; i++) {
var propertyName = macroAliases[i]
// Vi opdaterer macroStringen
if (document.forms[0][macroAliases[i]].type == 'checkbox') {
if (document.forms[0][macroAliases[i]].checked)
macroString += propertyName + "=\"1\" ";
else
macroString += propertyName + "=\"0\" ";

} else if (document.forms[0][macroAliases[i]].length) {
var tempValue = '';
for (var j=0; j<document.forms[0][macroAliases[i]].length;j++) {
if (document.forms[0][macroAliases[i]][j].selected)
tempValue += document.forms[0][macroAliases[i]][j].value + ', ';
}
if (tempValue.length > 2)
tempValue = tempValue.substring(0, tempValue.length-2)
macroString += propertyName + "=\"" + tempValue + "\" ";
} else {
macroString += propertyName + "=\"" + pseudoHtmlEncode(document.forms[0][macroAliases[i]].value) + "\" ";
}
}

if (macroString.length > 1)
macroString = macroString.substr(0, macroString.length-1);

if (document.forms[0].macroMode.value == 'edit') {
var idAliasRef = "";
if (document.forms[0]["umb_macroAlias"].value != '')
idAliasRef = " macroAlias=\"" + document.forms[0]["umb_macroAlias"].value;
else
idAliasRef = " macroID=\"" + document.forms[0]["umb_macroID"].value;

parent.opener.umbracoEditMacroDo("<?UMBRACO_MACRO" + idAliasRef +
"\" " + macroString +
">");
} else {
parent.opener.umbracoInsertMacroDo("<?UMBRACO_MACRO macroAlias=\"" + document.forms[0]["umb_macroAlias"].value +
"\" " + macroString +
">");
}
window.close()
}

function pseudoHtmlEncode(text) {
return text.replace(/\"/gi,"&amp;quot;").replace(/\</gi,"&amp;lt;").replace(/\>/gi,"&amp;gt;");
}
mchung
Posted: Thursday, August 17, 2006 10:26:22 AM
Rank: Enthusiast

Joined: 8/3/2006
Posts: 24
Don't think that appeared properly, so here's the code again:

http://rafb.net/paste/results/HQoTO651.html
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.