SP2010 - Creating New Item with Field Populated from previous form

Jun 23, 2014 at 3:34 PM
Ok, not sure if this is possible. I've been looking around for the past week for some sort of code to do this. The only thing REMOTELY close would be $().SPServices.SPRedirectWithID, but that's not quite what I need.

Here's the scenario:

I have a form that has 2 webparts. WebPart1 which refers to ListA, and WebPart2 which refers to ListB.

ListA is the parent list. So someone is editing the form for ListA. At the bottom is WebPart2 which is filtered from ListA on FieldA so it only shows the related items in ListB.

I have an ADD ITEM option on WebPart2 to add items to ListB.

What I would like to do is prepopulate FieldB on the new item form with the value from FieldA on the current ListA form that is open behind it.

I've seen there are options on editing the ADD NEW ITEM link, but couldn't see a way of doing it, so I wasn't sure if there was a nifty SPService function that could help me here.

Jun 24, 2014 at 1:47 AM
It's hard to understand the actual setup, but the short answer is: yes, this can be done.

Here are the things to consider/design:

1. The URL to the new form needs to include the value that will be used to prepopulate the field. Ex: NewForm.aspx?FieldB=valueToBePrepopulated

2. The new code needs to include code that reads the URL params, and if FieldB has a value, then prepopulate the field.

You might be able to find code out there that does form field prepopulate. I wrote such a method when I worked on a SP book (plug), here: http://www.amazon.com/gp/aw/d/B00ECGQ1G0

Paul T.

-- Sent from Mobile