JQuery从SharePoint列表中检索值

时间:2017-03-15 12:17:52

标签: javascript jquery sharepoint caml

下午全部SharePoint Currency Exchange List

我继承了一个JavaScript文件。我尝试做的是当用户从SharePoint列表的下拉菜单中选择一种货币,然后在第二个字段中输入一个金额,然后在第三个字段中进行转换和更新。

我已经让文件显示所选货币和金额的提示,现在下一步是我想要一个警报来显示货币兑换以证明它已获得它。

这就是我挣扎的路线:

var ExchangeRate = ($(obj).attr("Exchange_x0020_Rate"));

附上汇率列表的屏幕抓取及其下面的代码,任何帮助将不胜感激!

<script src = "/sites/it/SiteAssets/scripts/sputility.js" type = "text/javascript"> </script>

<script type = "text/javascript">

    $(document).ready(function() {});

function PreSaveAction() {
    var ExchangeRate
    var CurrencySelected = $("select[title='Currency']").val();
    var ContractCurrencyValue = $("input[title='Actual Amount in Currency ']").val();

    alert(CurrencySelected);
    alert(ContractCurrencyValue);

    $().sputility({
        operation: "Getlistitems",
        listName: "Currency Exchange Rates",
        async: false,
        CAMLQuery: "<Query><Where><Eq><FieldRef Name='Title'/><Value  
        Type = 'Text' > " + CurrencySelected  + " < /Value></Eq > < /Where></Query > ",
        CAMLViewFields: "<ViewFields><FieldRef  
        Name = 'Exchange_x0020_Rate' / > < /ViewFields>",
        completefunc: function(xData, Status) {
            $(xData.responseXML).SPFilterNode("z:row").each(function() {
                var ExchangeRate = ($(obj).attr("Exchange_x0020_Rate"));
                //var CurrencyValue = ExchangeRate*ContractCurrencyValue;
            });
        }
    });
    alert(ExchangeRate);
    alert(CurrencyValue);
}
  </script> 

0 个答案:

没有答案