I found several articles about how to get a single value from a sharepoint custom list, but I am new to javascript and so I cound't implement them to my situation.
I belive what is want is quite simple: I have a list with 2 column Name and ID. The use enter the ID (what is a unique value) in a new form (different from the list's new form) to a textbox and the Name from the same row appears in an other textbox. So:
User enter the
IDto a textbox and press enter/click out/ect.Based on the enterred
IDthe script search in the targeted list'sIDcolumn for theID.If the ID exist the
Name's value from the same row inserted to an empty textbox in the form where the user enterred theIDto the first textbox.
Sounds easy but even after several attempt I only got [object Obecjet], [object promises] ect. And finaly when I tought it should work I got a random text "Next Page" insted of the Name so probably I am doing something wrong. So I would be glad if someome who experienced would show me an example code for this situation.
I add my code too, it is not contains errors, but give me the "Next Page" instead of working well:
< script type = script type="text/javascript "src = ".../SiteAssets/jquery.min.js" > < /script>
< script type = "text/javascript "src".../SiteAssets/nanoajax.min.js" > < /script>
< script type = "text/javascript "src".../SiteAssets/sharepointplus-4.0.min.js" > < /script>
< script type = "text/javascript" >
$(function() {
$SP().list("TargetListTitle").get({
fields: "NameColumnTitle",
where: 'IDColumnTitle = 101'
}).then(function(res) {
for (var key in res) {
$("input[id='EmptyTextfieldID']").val(key);
}
});
});
< /script>
Thanks you very much for your kind guidance!