0

I cant seem to add an item in more than 2 columns. I have 3 columns, Employee ID, Employee Name, and Employee Email.

I can add in the Employee ID and the Name, but when adding the email it does not add. No error message too. Please Help.

function register(){

     var values = [];

     values.push(["EmployeeNumber",  $("#tbEmployeeID").val()]); 
     values.push(["EmployeeName", $("#tbEmployeeName").val()]);   
     values.push(["EmployeeEmail",$("#tbEmployeeEmail").val()]);


    $(function(){
        $().SPServices({
                        operation: "UpdateListItems",
                        async: false,
                        listName: "sampleList",
                        batchCmd: "New",
                        valuepairs: values,
                        completefunc: function (xData, Status) {
                            alert("Completed");
                        }
            });    
});
};
1

There have to be commas between the value pairs:

[
  ["EmployeeNumber",  $("#tbEmployeeID").val()],
  ["EmployeeName", $("#tbEmployeeName").val()],
  ["EmployeeEmail",$("#tbEmployeeEmail").val()]
]
  • values.push has the same effect. Pushing the array will automatically give it commas. I also tried your code and it still doesnt work – Rey Norbert Besmonte May 4 '16 at 14:03
  • What's the output from $("#tbEmployeeEmail").val()? It has to be entered as a person field. For example ["EmployeeEmail","23;#John Smith"] – Erin L May 4 '16 at 14:06
  • Yup I see now.. the problem was not the array. it was the data type of the entry.. Employee Email outputs Person or Groups.. Same goes for the date I guess. The date also dont enter. But I added another column which is a single line and it works. Any advice on how to enter a person or group and date? – Rey Norbert Besmonte May 4 '16 at 14:16
  • Date has to be (off the top of my head) 2016-05-04T09:21:00Z – Erin L May 4 '16 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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