I am trying to update my list. My codes already worked but I don't know what happened. When I designed my page, then hit Ctrl +S, then upload it again to share point, the codes didn't run already. I have deadline.
When I click table row, information goes to text box. When I change something in the tex tbox and clicked button, the table should update, but in my codes, it doesn't work.
Here's my code for SP Services: I don't know if I miss something or if I deleted something. I'll appreciate your answers. I hope for fast replies. Thanks a lot!
function Updatethis(){
var method = "UpdateListItems";
var list = "RFA_BODIList";
var id=document.getElementById('ID').value;
var supfunc=document.getElementById('supfunc').value;
var tn=document.getElementById('tn').value;
var td=document.getElementById('td').value;
var ttype=document.getElementById('ttype').value;
var prio=document.getElementById('prio').value;
var func=document.getElementById('func').value;
var req=document.getElementById('req').value;
var rsum=document.getElementById('rsum').value;
var fieldsToRead = "<ViewFields>" +
"<FieldRef Name='ID' />" +
"<FieldRef Name='Title' />" +
"<FieldRef Name='TicketNumber' />" +
"<FieldRef Name='TicketDescription' />" +
"<FieldRef Name='TicketType' />" +
"<FieldRef Name='Priority' />" +
"<FieldRef Name='RequestorFunctionalArea' />" +
"<FieldRef Name='Requestor' />" +
"<FieldRef Name='RequestSummary' />" +
"<FieldRef Name='RequestDate' />" +
"<FieldRef Name='Status' />" +
"</ViewFields>";
var query = "<Query>" +
"<Where>" +
"<Eq>" +
"<FieldRef Name='ID'/><Value Type='Number'>" + id + "</Value>" +
"</Eq>" +
"</Where>" +
"</Query>";
$().SPServices({
operation: method,
async: false,
listName: list,
CAMLViewFields: fieldsToRead,
CAMLQuery: query,
updates: "<Batch OnError='Continue' PreCalc='TRUE'>" +
"<Method ID='1' Cmd='Update'>" +
"<Field Name='ID'>" + id + "</Field>" +
"<Field Name='Title'>" + supfunc + "</Field>" +
"<Field Name='TicketNumber'>" + tn + "</Field>" +
"<Field Name='TicketDescription'>" + td + "</Field>" +
"<Field Name='TicketType'>" + ttype + "</Field>" +
"<Field Name='Priority'>" + prio + "</Field>" +
"<Field Name='FunctionalArea'>" + func + "</Field>" +
"<Field Name='Requestor'>" + req + "</Field>" +
"<Field Name='RequestSummary'>" + rsum + "</Field>" +
"</Method>" +
"</Batch>",
completefunc: function (xData, Status) {
alert(updates);
alert(id);
alert(supfunc);
alert(tn);
alert(td);
alert(ttype);
alert(prio);
alert(func);
alert(req);
//location.reload();
}
});
}
Here's my codes for text boxes and button:
<div class="inputWrapper" style="margin-top: 40px;">
<input type="text" id="ID"/>
<input type="text" id="supfunc"/>
<input type="text" id="tn"/>
<input type="text" id="td"/>
<input type="text" id="ttype"/>
<input type="text" id="prio"/>
<input type="text" id="func"/>
<input type="text" id="req"/>
<input type="text" id="rsum"/>
</div>
<input type="button" value="Update" class="Updatethis" onclick="Updatethis()"/>