Sunday, August 4, 2013

Make the auto-poplated fields read-only in the NewForm?

Hi Guys,


I have some fields in my customized NewForm that were being populated automatically by JavaScripts so I would like them to become read-only fields. I tried changing the ControlMode of the field in SharePoint Designer from New to Display but we are not getting accurate results doing so.



We are using this code to auto-fill the Initiator field for example.



<script type="text/javascript" language="javascript">
$(document).ready(function() {
var userName = $().SPServices.SPGetCurrentUser({
fieldName: "Title"
});
$("input[Title='Initiator']").val(userName);
});</script>

I would just like to ask for some inputs guys on how we can possibly achieve this.


Thanks in advanced,


Arnel


No comments:

Post a Comment