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
Hi Paul, Yes #QueryContent is a <UL>
<ul style="list-style-type:none;" id="Querycontent"><li></li></ul>
I am trying to replace the <li> values within the #Querycontent <ul> when the form fields change, when i do this at the moment it only returns one value.

I tried to add your code, but had some issues, i wasn't sure about the 'liHtml +=' and the 'var $Querycontent'.

Here is what i have got now:
    $('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);
        
            var liHtml = "";
        
                $().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) {
                $(xData.responseXML).SPFilterNode("z:row").each(function() {
                var DocNo = ($(this).attr("ows_DocumentNo"));
                var href = ($(this).attr("ows_View_x0020_Item")).split(",")[0];
                var liHtml = "<li><a href='"+ href +"' target='_blank'>" + DocNo + "</a></li>";  
                $("#Querycontent").empty().append(liHtml);   
                });
                }
                });
    });
This Code only returns a single value when i change a form field.

Thanks,

Tucker

Viewing all articles
Browse latest Browse all 6517

Trending Articles



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