This project has moved and is read-only. For the latest updates, please go here.

SPUtility.GetSPField('xxx').SetValue('yyy') does not seem to be updating the field properly with the paramter value

Jun 5, 2014 at 11:42 PM
I have downloaded the most recent code of SPUtility.js and have used this to pass in a parameter to my NewForm.aspx (SharePoint 2007).

The field that I am wanting to set from the parameter is a dropdown that is using another list to populate the items in the list. The dropdown has been converted using SPServices.SPComplexToSimpleDropdown method.

The sample code you provided seems to be working in that the parameter value is displaying properly on the form. However, when I save the form, the value is not being saved. In fact, If I check the value of the field in the function PreSaveAction() by grabbing the object via getTagFromIdentifierandTitle(), it is not showing any value associated with it.

Additionally, if I go to the dropdown, change it to another value and then go back to the value that should have been picked up with the parameter, the PreSaveAction object now has a value.

I do not have this problem if I try to populate a text field using a parameter.

Any suggestions?

Jun 11, 2014 at 3:01 PM
Sorry for the delayed reply, I have been absolutely swamped.

SPUtility.js is currently coded to work with the out of the box SharePoint forms so any customization will likely interfere. Looks like SPComplexToSimpleDropdown just converts the lookup to a dropdown so we might be able to modify SPUtility to work in that situation.

It seems like you are comfortable with JavaScript so I would recommend trying to get it working using plain jQuery first. Take a look at the implementation for SPDropdownChoiceField's SetValue function in to get you started.