Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Based on How to add new field to custom list (See edit!)

It is a different question relating to the above so thought I'd create a new question as the above was technically answered.

But after adding a new field (Staff Type) to the list I can create new list items without a problem, all values get stored correctly. However, if I edit an existing list item and change the Staff Type then a new list item will be created with default values for all fields except Staff Type. It maintains the value that Staff Type was changed to.

If I edit a list item but don't change the Staff Type, all other fields update correctly.

Any help much appreciated.

EDIT: Ok a detailed description (with pictures)

I create a new course (NewForm.aspx)

enter image description here

You can see I have set the new field, Staff Type and the Title has been set.

I display the course (DispForm.aspx)

enter image description here

You can see that all fields are set as I entered them in NewForm.aspx

I go to edit the course (EditForm.aspx)

enter image description here

You can see that I have changed the Title and added a selection to Staff Type.

When I save it it has done 2 things. Created a new course at the date and time of the save with the new Staff Type selections and empty fields for the rest.

enter image description here

It has also saved the original list item's Title, as I would have expected the Staff Type to be saved also. But the Staff Type is still what was entered in NewForm.aspx.

enter image description here

Does this clarify matters any?

share|improve this question
    
This isn't making a lot of sense to me. Can you clarify it a little, perhaps give file names of the pages you are referring to when these issues are occuring. It's sounding like you have what you think is an edit form but is acting like a new form. Can you go into the list and use the default EDitForm.aspx page? –  PirateEric May 18 '11 at 15:04
    
Yes, it is in EditForm.aspx. As I said I can change all fields on the form and they update correctly, except for Staff Type. Say I update the Title and the Staff Type. A new list item will be created with the current date and time and only the Staff Type will be populated. But also, it will have edited the Title in the original list item correctly. –  anothershrubery May 18 '11 at 15:09
    
I have edited above with pictures to try to describe the problem more clearly. –  anothershrubery May 18 '11 at 15:36
    
+1 for screenshots :) –  Andrey Markeev May 18 '11 at 15:51

2 Answers 2

up vote 1 down vote accepted

Ok I found the answer! Complete "D'oh" moment. On the SharePoint:FormField it had the property

__designer:bind="{ddwrt:DataBind('i'......etc

I replaced the i with a u

__designer:bind="{ddwrt:DataBind('u'......etc

And it works. Can anyone explain what the difference is?

EDIT: A quick check sees i is insert and u is update. I have spent too long looking into this simple mistake. What's the point in ControlMode if you need this set as well?

share|improve this answer
    
ControlMode is if you construct the FormContext yourself completely. Ie. using FormFields in an Application Page. –  Tim Ebenezer May 19 '11 at 13:31

Try changing the ControlMode on SharePoint:FormField to Edit.

share|improve this answer
    
It is set to Edit –  anothershrubery May 18 '11 at 15:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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