문제

I have 3 date fields into my list, but I want to disable one of them.

Column name = Fecha

I try to achieve it adding Script Editor like this:

enter image description here

Code:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>

<script>
var itemID = $(" input[title='Fecha'] ").attr("id");



var itemCode = itemID.substring(0, itemID.indexOf('$'));



$( "[id^=" + itemCode + "] td.ms-dtinput > input[id$='Date']" ).attr('readonly', 'readonly');



$( "[id^=" + itemCode + "] td.ms-dtinput > a" ).attr('onclick','').unbind('click');



$( "[id^=" + itemCode + "] td.ms-dttimeinput > select[id$='DateHours']" ).attr('disabled', 'disabled');

$( "[id^=" + itemCode + "] td.ms-dttimeinput > select[id$='DateMinutes']" ).attr('disabled', 'disabled');
</script>

But it just don´t works, I try to debug it into new item view but I cant see code of script I insert into Script Editor, what is wrong there? Regards

도움이 되었습니까?

해결책

Your js code does not run, because you have added Scrip Editor Web Part to the list view. If you want to disable field in New Item form, you have to modify Default New Form and add appropriate code there: Editing Default New Form

You can do same thing with Default Edit Form

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top