0

When using SPServices, is it possible to use a variable to specify the column to be updated?

res = lists.quickUpdateListItem('MyListHere', { ID: ReqD, columnVar : userName });

In the above statement, is it possible to use the variable columnVar in this way? I have not been able to successfully get this to work. It does not throw an error, but it just simply doesn't update.

2
  • Really? You edited my question to fix 'doesnt' to 'doesn't' ...?
    – dah97765
    Commented Jun 20, 2012 at 21:14
  • I have answer but I can't post it until more than 8 hours passes. I'll update soon :)
    – dah97765
    Commented Jun 20, 2012 at 21:18

1 Answer 1

1

This is possible, but its not very obvious. The library differentiates between what you're passing into the function. If you build an array and then pass that in instead, you can build this dynamically as I was hoping:

var columnVar = whatever your column name is;  
var myArray = new Object(); 
myArray['ID'] = ReqD; 
myArray[columnVar] = userName;
res = lists.quickUpdateListItem('MyListHere', myArray); 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.