This project has moved. For the latest updates, please go here.

Error creating field named xxx

May 10, 2016 at 2:52 PM
Hi!
First, sorry but my poor english...

Testing SPUtility on my environment, I think is a great tool. All fine on Sharepoint 2007 server. But, having problems on Sharepoint 2013.
  • I do the installation of the scripts at /js/ directory on my site (I try to save them on SiteAssets too).
  • Simple list called list1, with 2 fields: Title and Columna1
  • Add a content editor before and after the fields on the NewForm.aspx with the simple example:
<script src="/js/jquery-1.12.3.min.js"></script>
<script src="/js/sputility.min.js"></script>
<script>
// wait for the window to load
$(document).ready(function () {
   // EXAMPLE: Set the value of the Title field to Hello world!
   SPUtility.GetSPField("Columna1").SetValue("Hello world!");
});

</script>
When creating new item, with F12 going to console, and it gives "Error creating field named Columna1:Unable to retrieve the input control for Columna1"

I tried with your gettingstarted.html script. All fine on Sharepoint 2007, but on 2013 it only gives on screen "OK! jQuery was loaded!" and "OK! SPUtility was loaded!", but no info about fields. In this case, goint to console and get 'Error creating field named Title: Unable to retrieve the input control for Title'

Where is my mistake???
Coordinator
May 11, 2016 at 2:27 AM
Sounds like everything should be setup correctly since you were able to get the gettingstarted.html page working.

A common problem with SharePoint 2013 default installs is that MDS is enabled. Have you checked that? More info here http://sputility.codeplex.com/wikipage?title=Troubleshooting&referringTitle=Installation

Also the form wasn't customized with SharePoint designer?
May 11, 2016 at 6:27 AM
Edited May 11, 2016 at 6:27 AM
Thanks for your fast reply Kit!
I checked your troubleshooting page, and verified that JQuery and SPUtility returns a correct return. About MDS, initially was enabled, but I disabled it with no success.
My environment is in spanish language, maybe this is the problem??
Coordinator
May 12, 2016 at 1:12 AM
Ok cool, so now that you've disabled MDS you should no longer see /_layouts/15/start.aspx in the URL when you visit your list forms.

Regarding your spanish language settings, those should be OK. You might want to change some of the settings to work better with date and number fields:
SPUtility.Setup({
   'timeFormat': '24HR',
   'decimalSeparator': ',',
   'thousandsSeparator': '.',
   'stringYes': 'Si',
});
More info here.

Are the list forms out of the box? Customized with SharePoint Designer or InfoPath?
May 12, 2016 at 6:24 AM
Edited May 16, 2016 at 2:42 PM
Thank you Kit, I appreciate your help.

About your question, yes, I don't se /_layouts/15/start.aspx since I disabled MDS. I am editing the default form Newform.aspx. When I click on "New element" link, the address is _http://mySite:9000/Lists/testList/NewForm.aspx_

I don't know what can I do...
May 16, 2016 at 2:45 PM
Hello Kit!
Some updates about this misteryous situation. I test the script on another server, with the same built number of SharePoint Foundation 2013, and it runs!
So, I decided to reinstall all SharePoint Foundation on the production server (it has just 2 little applications), and the issue persist!! I'm very frustrating... Any clue to solve the mistery??
Coordinator
May 18, 2016 at 1:56 AM
I'm sorry to hear you're having so many problems getting it working and that you reinstalled sharepoint... that definitely should not be necessary. :(

Can you contact me via my blog? It will send me an email and maybe we can work something out.
Jun 9, 2016 at 8:56 PM
Edited Jun 9, 2016 at 8:58 PM
I'm having the same issue but it works in Chrome.
IE11 produces the follow error:

SCRIPT5022: Error creating field named XXX: Unable to retrieve the input control for XXX
File: sputility.min.js, Line: 10, Column: 3302


Environment
Windows 7
IE11
Chrome 51
MDS disabled, jQuery and SPUtility loaded.

Here is my code:

SPUtility.GetSPField('DEBUG_MODE').Checkbox.checked = true;
SPUtility.GetSPField("DEBUG_MODE").SetValue(true);

Both methods produce the same error. I'm using the same code all over the page but it seems to fail for a checkbox in IE11.

Anyone have ideas?
Alternate code or fix that can be cross browser?
Jun 9, 2016 at 9:32 PM
It was a timing issue on my side. IE is slow.... :)
Modified my code and boom, it worked.

THANK YOU KIT for making our lives with SP a little easier ;)