2

I have created new Custom Edit Form for one of my List and trying to set Value using SPUtility.js.

I am constantly getting error

Unable to get a SPField named Title(Field Name)

But same piece of code works fine in default Edit/New Form for that List.

SPUtility.GetSPField("Title")

Any Suggestions..

2
  • In the above blog ref. "add tag before <SharePoint:FormField> tag" Can you provide step by step when can we find the above file path? Does effect other list n libraries in the site collection level? Nov 30, 2018 at 20:03
  • @JayDoshi: Thank you! That solved my own [problem] with SPCascasedropdowns (SPServices) as well. regards Ben [problem]: sharepoint.stackexchange.com/questions/293466/…
    – Ben
    May 9, 2021 at 11:58

2 Answers 2

2

Rendering of Default List Forms & Customize List forms are different. If you want to work SPUtility successfully in your custom list forms, then you have to add some of the tags in your custom list form.

  1. Add class in table tag

    • Find your first field <tr> in your custom list form
    • Find it's parent table tag. You get something like below tag: <table border="0" cellspacing="0" width="100%"> modify it as: <table width="100%" class="ms-formtable" style="margin-top:8px;" border="0" cellpadding="0" cellspacing="0">
  2. Now go to your field and add below tag before <SharePoint:FormField> tag.

    • <xsl:comment>FieldName="Title" FieldInternalName="Title" FieldType="SPFieldText"</xsl:comment>
    • Replace value in above tag FieldName with Field Display Name, FieldInternalName with Internal Name of the Field, FieldType with Type of the field.

Now you will be able to use SPUtility in your custom list pages also.

1

Are you including the debug version of the jquery library or the min version? I ran into this problem and found the solution to be a bit strange, but I received this error when using jquery-3.1.0.js and it ran perfectly when using jquery-3.1.0.min.js. I doubt you'd be using the .min.js for one form and the debug version for another, but I thought it was worth sharing my solution in case that's what you are doing.

It's worth noting that even when I included the min.js version in my Content Editor web part, it would still give me the error if I had the debug version included in my master page, since it was loading them both.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.