質問

I have issue in lookup field. When item in lookup field are too large, it throws error "Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.".

Is there any solution for that without hiding that column?

I want that field in my new item form but new item form is not opening due to large number of items in lookup field.

I do not want all the lookup items in that field. I just want empty dropdown of that lookup field so i can set value using jslink and lookup field data is saved when i click on Save button.

enter image description here

Thanks

役に立ちましたか?

解決

I used for the similar task:

  1. Get Lookup Id from query string

<ParameterBinding Name="RootDocId" Location="QueryString(RootDocID)" DefaultValue=""/>

  1. Replace on NewForm.aspx

<SharePoint:FormField runat="server" id="ff5{$Pos}" ControlMode="New" FieldName="RootDocument" __designer:bind="{ddwrt:DataBind('i',concat('ff5',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@RootDocument')}"/>

with

<asp:TextBox runat="server" id="ff5{$Pos}" text="{$RootDocId}" value="{$RootDocId}" __designer:bind="{ddwrt:DataBind('i',concat('ff5',$Pos),'Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@RootDocument')}" />

Building custom forms

UPD: To use custom form:

  1. Open NewForm.aspx in Designer

  2. Place cursor just above <WebPartPages:ListFormWebPart> tag - the default form

  3. From "Insert" tab on ribbon use "New Form" button to place it on page

  4. Drop the default form from page.

他のヒント

You can try increasing maxJsonLength in the web.config:

<configuration>
 <system.web.extensions>
   <scripting>
    <webServices>
      <jsonSerialization maxJsonLength="10000000"/>
    </webServices>
  </scripting>
 </system.web.extensions>
</configuration>

Why can't the JSon set for the drop down field be emptied or nullified and then assigned, so that the control is empty as expected on loading.

In SharePointDesigner we created 3 forms realted with the list (New, Edit,Display). These forms are the default ones.

Now we can open, edit and create items.

ライセンス: CC-BY-SA帰属
所属していません sharepoint.stackexchange
scroll top