function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
LogmiLogmi 

missing = in XML attribute

Hi,

Thank you for any help.  I have the S-control below.  I added a custom button to a new tab I created.  If I select the "Content Source" as "Custom S-Control"  it works fine.  However is I select "OnClick JavaSript" instead, I get an message

"A problem with the OnClick JavaScript for this button or link was encountered.  missing = in XML attribute".

Do you know what I'm missing? 

Code:
<script src="/soap/ajax/14.0/connection.js"
type="text/javascript"></script>
<script>
var psk = "x";
var companyid= "1"; 
gethostlist();
function gethostlist() {


var envelope ='<—xml version="1.0" encoding="utf-8"–>'+
'<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">'+
'<soap12:Body>'+
'<gethostslist xmlns="https://secure.site.com/ws/hostGetList.asp˜companyid='+companyid+'&psk'+psk+'">'+
'</gethostslist>'+
'</soap12:Body>'+
'</soap12:Envelope>';


sforce.connection.remoteFunction({
url : "https://secure.site.com/ws/hostGetList.asp™companyid="+companyid+"&psk="+psk,
requestHeaders: {
"Content-Type": "xml",
"SOAPAction": "https://secure.site.com/ws/hostGetList.asp?companyid="+companyid+"&psk="+psk
},

requestData: envelope,
method: "POST",
onSuccess : function(response) {
if(response.substr(0,2)=="OK")
{
alert("success")
convertThis(response);
}
else
{
alert("fail")
}
},
onFailure : function(response) {
}
}); 
return;
}


 

werewolfwerewolf
Did you use Firebug to look into the envelope variable to see what it actually contains?  Chances are the error message is telling you exactly what the problem is -- your XML is missing an = (or it's getting truncated somewhere by an errant quote in building envelope).