我正在創(chuàng)建一個(gè)屏幕,該屏幕需要根據(jù)是否提供了某些字段來刪除和添加一些值到選擇字段。我的表格要求在編輯期間(而不是在新建期間)提供某些字段。因此,在進(jìn)入屏幕后,我從狀態(tài)字段中刪除了一些選項(xiàng),特別是值“建議”。一旦用戶更改了其他字段,我會(huì)查看現(xiàn)在是否填充了所有適用的字段,我想重新添加“建議”選項(xiàng)作為選擇。這是下面需要的,靠近代碼的末尾。該行是:(雖然不起作用)。 $("select[title='Status'] option").add(ProposedOption);這是我的代碼:<script type="text/javascript">$(document).ready(function() { //don't exectute any jsom until sp.js file has loaded. SP.SOD.executeFunc('sp.js', 'SP.ClientContext', ChkUser);});function ChkUser(){ //var admingroup = "DMSDataManagement Owners"; //console.log('selected='+'Admingroup='+admingroup); //Lozzi.Fields.disableWithAllowance("Status",[admingroup]); //Lozzi.Fields.disable("Status"); Lozzi.Fields.hide("ApprovedBy"); Lozzi.Fields.hide("DateApproved"); Lozzi.Fields.hide("PreviousStatus"); var selectedValue = ($("h3:contains('Status')").closest('tr').find('select').val()); //alert('Selected='+selectedValue); ProcessStatusValues(selectedValue); //on change of dropdown of Is this Critical we will call this $("h3:contains('DataDomain')").closest('tr').find('select').change(function () { //CheckMandatory(selectedValue); ProcessStatusValues(selectedValue); });}先感謝您。
在“新建”或“編輯”表單中添加和刪除選項(xiàng)字段的選項(xiàng)
湖上湖
2022-06-09 19:35:14