Has anyone ever successfully added a new item to a list which is used as the source for a lookup column while using an EditForm (or NewForm, same mechanism) and been able to save the form successfully with the new value?
Here’s what I mean:
- I have a list called Regions with a lookup column called Country
- Country is a lookup into Countries.Title
- In my Regions EditForm, I’ve got a call to UpdateListItems using SPServices which adds a new value to Countries
- I add the new option to the Country dropdown (select) using the new ID and innerHTML and set it as “selected”
- When I save the Regions EditForm with the new value selected I get the dread “An unexpected error has occurred.”
I've checked with Firebug and the correct ID for the newly created lookup value is what is sent with the POST, so I believe that my script is doing what it should.
I can still save the form with no problem if I select any of the previously existing lookup values. Only the new value throws the error.
I’ve fiddled with this too much. I’m wondering if SharePoint’s trying to be “smart” here by only allowing values which existed when the form was originally loaded.
Any ideas?