Question

I'm trying to make a task-form field (SP2010) read-only using SharePoint Designer.

  1. I created a new form and set it as default.
  2. Open the newly created form in advanced mode in SPD.
  3. Change ControlMode for two values from "New" to "Display" and save the form.

After the changes when I open the new form, field is read only as expected. But values are saved empty in the list. Can anybody have idea on this?

Was it helpful?

Solution

Remove __designer:bind="" and compare the results.

For the new form, you’d better use scripts to make the field read only as Dante mentioned.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
 $(document).ready(function()
{
//Set the Field to Read only and change its background colour
$("input[title='<field>']").attr("readonly","true").css('background-color','#F6F6F6');
//You can disable the field also:  $("input[Title='<field>']").attr("disabled", "disabled");
});
</script>

How to Make SharePoint List Column (Form Field) Read Only

OTHER TIPS

I've never needed to mark a field as read-only, but why dont you simply set it with javascript ? Since you're still editing the page in sharepoint designer you could use JS to make it readonly as it gives you a bit more control over the field.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top