Pergunta

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

Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange
scroll top