I want to fill the fields of a form, that I builded by an app in visual studio using JavaScript, from another custom list. my problem is in this code and how to do this with JavaScript.

function successHandler(data, req) 



    var cltHTML = "";
    var enumerator = allListClients.getEnumerator();
    while (enumerator.moveNext()) {
        alert("Retrieve Data");
        var client = enumerator.get_current();
        cltHTML = cltHTML + client.get_item("Title");
  • I think you've communicated what you are trying to accomplish, but I think we'll probably need some more information to give you an answer that's very helpful -- What problem are you having with this code? Is it a specific error message? Unintended behavior with no error message? Additionally, I understand this is a success handler for something, if you describe the issue you're having, we may need some more of your code to understand all of the functions and variables you're using. In what you've showed us, you are never doing anything with the cltHTML variable after you populate it. – John-M Aug 14 '14 at 2:05

I would use the SPServices UpdateListItem function for this. Set your form information to a JQuery variable and use SPServices to update the list data from there.

<input type="text" class="myInput"></input>

<script type="text/javascript" src="it/_layouts/js/jquery-1.8.2.js"></script>
<script type="text/javascript" src="it/_layouts/js/jquery.SPServices-0.7.2.min.js"></script>

<script type="text/javascript">

var myField = $(."myInput").val();

  operation: "UpdateListItems",
  async: false,
  listName: "Your List",
  ID: ID of List Item,
  valuepairs: [["MyColumn", myField]],
  completefunc: function (xData, Status) {



Just a basic idea, but this will help some I hope.

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.