Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: Reload GetListItems on Form Change

$
0
0
Try this:
$('form :input').change(function() {
    
    var DocumentID = $('#ctl00_m_g_a98b84c2_da23_4861_aba3_de78ad6ca2fb_ff16_1').val();
    var DocumentType = $("option:selected", $("select[title='Document Type']")).text();
    var Discipline = $("option:selected", $("select[title='Discipline']")).text();
    var SeqNo = $("input[title='Sequence No']").val();
    var PAWONo = $("input[title='PO / WO Number']").val();

    $("input[title='Document No']").val("MP0041" + '-' + PAWONo + '-' + Discipline + '-' + DocumentType + '-' + SeqNo);
    
    $().SPServices({
        operation: "GetListItems",
        async: false,
        listName: "Vendor Register",
        CAMLViewFields: "<ViewFields><FieldRef Name='DocumentNo' /><FieldRef Name='View_x0020_Item' /></ViewFields>",
        CAMLRowLimit: 5,
        CAMLQuery: "<Query><Where><And><Eq><FieldRef Name='Discipline'/><Value Type='Text'>" + Discipline + "</Value></Eq><Eq><FieldRef Name='DocumentType'/><Value Type='Text'>" + DocumentType + "</Value></Eq></And></Where><OrderBy><FieldRef Name='Created' Ascending='FALSE' /></OrderBy></Query>",
        completefunc: function (xData, Status) {
            
            var liHtml = "";
            
            $(xData.responseXML).SPFilterNode("z:row").each(function() {
            
                var DocNo = ($(this).attr("ows_DocumentNo"));
                var href = ($(this).attr("ows_View_x0020_Item")).split(",")[0];
                liHtml += "<li><a href='"+ href +"' target='_blank'>" + DocNo + "</a></li>";  
                
            });
            
            $("#Querycontent").empty().append(liHtml);   
        }
    });
});
/Paul

Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>