I have been to Jan Tiernans blog, and figured out how to grab column names using Soap and jquery/jscript. I can't figure out how to grab custom columns with special chars though.
I have read about obtaining the internal field names (ie:DB%5fx0020%5fType for a column named 'DB Type'). However, when I use these in code, it does nothing.
I have no access to sharepoint designer, I am doing all of this out of a CEWP. This is what I have (which works wonderfully for any one word column ie - Title and ID):
<script type="text/javascript" src="path to..javascript/Scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="path to..javascript/Scripts/jquery.listmenu-1.1.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var soapEnv =
"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
<soapenv:Body> \
<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
<listName>supported_applications</listName> \
<viewFields> \
<ViewFields> \
<FieldRef Name='Title' /> \
<FieldRef Name='ID' /> \
</ViewFields> \
</viewFields> \
</GetListItems> \
</soapenv:Body> \
</soapenv:Envelope>";
$.ajax({
url: "path to.../_vti_bin/lists.asmx",
type: "POST",
dataType: "xml",
data: soapEnv,
complete: processResult,
contentType: "text/xml; charset=\"utf-8\""
});
});
function processResult(xData, status) {
$(xData.responseXML).find("z\\:row").each(function() {
// var liHtml = $(this).attr('ows_ID') +": " +$(this).attr('ows_Title')+'<br>';
var liHtml = "<li><a href='path to.../Lists/applications/DispForm.aspx?ID=" + $(this).attr('ows_ID') + "'>" + $(this).attr('ows_Title') + "</a></li>";
$("#tasksUL").append(liHtml);
});
//function appendAnchor(
}
</script>
<ul id="tasksUL"/>
This all works beautifully, but once I sub an 'internal name' (which has special chars) for Title, nothing works
<FieldRef Name='ID' /> \
...
var liHtml = "<li><a href='path to.../Lists/applications/DispForm.aspx?ID=" + $(this).attr('ows_ID') + "'>" + $(this).attr('ows_Title') + "</a></li>";
becomes
<FieldRef Name='DB%5fx0020%5fType' /> \
...
var liHtml = "<li><a href='path to.../Lists/applications/DispForm.aspx?ID=" + $(this).attr('ows_ID') + "'>" + $(this).attr('ows_DB%5fx0020%5fType') + "</a></li>";
I believe from what I have read I must use the prefix 'ows' when reffering to these column names, however I have tried all sorts of different combos of names, nothing doing. What the heck am I doing wrong?