我在SharePoint网站中构建一个引导程序表单,无论出于何种原因,我的单选按钮都没有被定义为我的其余部分。
形式:
调试器:
PM_CreditCard:" 4444555511116666"
PM_Email:" W@gmail.com"
PM_LabelReceipts:" undefined"
PM_BillEstimates:" undefined"
SharePoint:它在SharePoint列表中定义。
代码:
function getItem() {
var item = {
PM_Email: $("#PM_email-input").val(), // Email
PM_LabelReceipts: $(":radio[name=labelreceipts]:checked").val(), // Label Receipts
PM_BillEstimates: $(":radio[name=billestimates]:checked").val(), // Bill Estimates Choice
PM_CreditCard: $("#PM_credit-card-input").val(), // Credit Card #
};
return item;
}
function AddListItem(resources) {
var item = getItem();
$pnp.setup({
baseUrl: ".................."
});
$pnp.sp.web.lists.getByTitle("Intake").items.add({
PM_Email: item.PM_Email,
PM_LabelReceipts: item.PM_LabelReceipts, // Radio Buttons
PM_BillEstimates: item.PM_BillEstimates, // Radio Buttons
PM_CreditCard: item.PM_CreditCard,
}).then(function(r) {
$("#submit").hide();
$("#cancel").hide();
var newItem = r.data;
window.location = 'Thank you page url...';
});
}

<div class="form-group row" style="margin-top: 5px;">
<label for="PM_label-receipts-input" class="col-lg-10" style="margin-top: 5px;">Label receipts as invoices</label>
<div class="col-lg-8">
<label class="radio-inline"><input type="radio" value="Yes" name="labelreceipts">Yes</label>
<label class="radio-inline"><input type="radio" value="No" name="labelreceipts">No</label>
</div>
<label for="PM_bill-estimates-input" class="col-lg-10 col-form-label" style="margin-top: 5px;">Receive Bill Estimates (received 2 weeks before recurring changes)</label>
<div class="col-lg-8">
<label class="radio-inline"><input type="radio" value="Yes" name="billestimates">Yes</label>
<label class="radio-inline"><input type="radio" value="No" name="billestimates">No</label>
</div>
</div>
&#13;
答案 0 :(得分:-1)
您正在设置全局变量 labelreceipts 和 billestimates ,并且DOM加载单选按钮的值为null,因为此时未检查任何内容。
您需要做的是在单选按钮单击事件中设置全局变量的值。这样,当单击单选按钮时,它们将始终更新。
检查以下代码
SELECT text,s1 FROM Table1 UNION SELECT text,s1 FROM Table2 ORDER BY s1;
&#13;