0

I've a simple requirement to disable a number of choice fields in a SharePoint Edit form.

I tried setting the attr('readonly','readonly') that didn't work, the choice field was still editable.

I then tried attr('disabled','disabled') this worked, in that the field was greyed out, with the previously set value displayed.. But on saving the other edited values the choice field reverted to hte first item in the choice list...

Any ideas gratefully received, I'm pretty new to this!

Cheers

Russ

   $("document").ready(function() {
    //$("select[title='Department']").attr('disabled', 'disabled');
    //$("select[title='Department']").attr('readonly', 'readonly');
});
4

3 に答える 3

0

As I understood you only apply that when your select is set to Department. If is that you need to create another function to removeAttr('disabled').

Once it is applied the attribute isn't removed automatically. Your code are saying that when document is ready (request) disable all select fields with Department.

于 2013-01-29T15:36:03.657 に答える
0

SharePoint リスト フォームは、実際には、保存アクションに機能をアタッチする方法を、JavaScript 関数と呼ばれる形式で公開します。PreSaveAction

これをリストフォームで宣言すると、ユーザーが [OK] をクリックした後、フォームがポストバックする前に呼び出されます。ここでフィールドを再度有効にします。保存を続行するかどうかをフォームに知らせるブール値を返す必要があります。

例えば

function PreSaveAction() {
   alert("Hi");
   // Re-enable any disabled fields here
   return true;
}
于 2013-10-09T23:59:10.303 に答える