0
votes

Help..

I have a custom new list item ASPX form. The form is working great, but I need to add custom functionality around the List Item name. I want to programmatically name the item upon the user clicking the save button. I have read a few ideas, but nothing fits the bill.

  1. I have read a number of articles about inheriting from SharePoint.WebControls.SaveButton, and inserting code in the the overriden SaveItem function. However since my List Name field is outside the scope of the SaveButton control, I can use this to modify the List Item name.

  2. I tried writting my own Save button. The Click event is saving the ListItem name before calling the SaveButton.SaveItem function. This works, but I have to have the still have to have the Name SharePoint:FormField on the page. If anyone enters a value into the FormField, it overrides my customized name. I also need to research a way to close the New Item form and refresh my List, that SharePoint:SaveButton does so nicely form me.

Ideas, throughs, suggestions?????

This would be so easy if Microsoft hadn't protected the SaveItem call.

1
I have tried a number of different resolutions. My implementation of the static SaveButton.SaveItem function, is resulting in a new Folder rather than a new Document Set. I have tried a number of different events (OnItemAdding & ContextsFormSave events). Currently thinking of trying to inheriting from SharePoint.WebControls.SaveButton again. So far, my attempts have failed. Although it looks like others have been successful. The other option is to write my own Document Set creation process within the WebPage. Then I will need to figure out how to redirect the user once the page is closed. - terahex

1 Answers

3
votes

It would be easier to just create an event receiver handling OnItemAdding event. You can inject your field values into the properties and they will be saved in the item.