Friday, February 5, 2010

How To Resolve 'object required' error in Custom Edit Form

If you get the JavaScript 'object required' error when you attempt to attach a file in your custom Edit Form, it is likely because of the 'idAttachmentsRow{generate-id()}' value in the 'id=' attribute in the table row (tr) tag.

Change the value to to 'idAttachmentsRow' (i..e. remove the {generate-id()} part), and the error will not occur.

Your updated code should look like this:

<tr id="idAttachmentsRow"> <td nowrap="true" valign="top" class="ms-formlabel" width="20%"> <SharePoint:FieldLabel ControlMode="Edit" FieldName="Attachments" runat="server"/> </td> <td valign="top" class="ms-formbody" width="80%"> <SharePoint:FormField runat="server" id="AttachmentsField{$Pos}" ControlMode="Edit" FieldName="Attachments" __designer:bind="{ddwrt:DataBind('u',concat('AttachmentsField',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Attachments')}"/> <script></script> </td> </tr>


No comments: