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

I've two lists, one of persons, and one of addresses for theses persons (my purpose is that one person may have multiple adresses).

I'd like, when I add a person, to be able to directly add an address for this person I've just added. Without having to navigate to the Adress list and select the person in the lookup field for to add an address for this person.

Here are the models of my lists :

Persons

  • Last Name
  • Firstname

Addresses

  • Street & Number
  • City
  • Person (Lookup field)

Currently, I've added some JavaScript to create a button on the new person form which send the name of the person in the URL (?name=Rupert) to the new address form. But then my person isn't yet created because I change the page while editing the new person form.

Do somebody know if there is a way to achieve this easily such as a magic option to say "when I add a person, go to the new address form and select automatically the person which has just been added in the lookup field?

Thanks a lot for your help !

share|improve this question
    
It might be a better idea to reference the Person list ID field, otherwise you'll run into trouble with duplicate names soon enough. If person/address is a master/slave or parent/child relationship, then the master or parent must exist before the slave or child can be created. Save the master or parent before allowing the creation of a slave or child. Then that master item will have a unique ID in the list and it can be referenced by the slave record. –  teylyn Apr 18 '13 at 10:03

2 Answers 2

up vote 1 down vote accepted

Parent/child relationships require the parent to exist before the child can be created.

This tutorial shows how to do it. The author has a few other techniques, involving javascript and/or SharePoint Designer.

share|improve this answer
    
Thanks that's how I started, it will allow me to go further in this way :) –  ggobbe Apr 18 '13 at 10:32

Why not only use on list, with Person as a User Field? Then you would be able to have all information you need in just on list, and extract it easily from the list.

(Works only if the persons are users of your site, otherwise you need a more graceful solution, involving a custom form page with code behind logic saving data to your two lists)

share|improve this answer
    
Theses persons aren't users of my site, there are stored in a Contacts-type list. Thus I suppose that I have to create custom form with code behind logic? I was hoping to find an easier solution. Thanks :) –  ggobbe Apr 18 '13 at 9:24
    
Well then I would go for the approach of creating a new application page where you design a form and then populate data in your lists from the code behind ond submission –  Robert Lindgren Apr 18 '13 at 9:25
    
OK thanks for your help, I'll go in this way if this feature is absolutely required for the project because it will take developing time. –  ggobbe Apr 18 '13 at 10:30

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.