How to display related info on text fields?

Jul 15, 2013 at 4:11 AM
Hi Guys,

Sorry to bother you with this simple issue because I’m stuck. I’m new to spservices so please be patient with me. I have 2 lists with these below details.

List1: Name, emailadd and contact columns
List2: Company,email and phone columns
Company is the lookup of Name in List1

Just wanted to know how can I use $().SPServices.SPDisplayRelatedInfo in this case to display the related info in the text fields of a new customized list form. So when I choose Company on List2’s new item form, related info should be populated on email and phone text fields. Can you guys help me how can I achieve this?

Thank You,

Arnel
Jul 15, 2013 at 6:36 AM
Hi Arnel,

Have a look at https://spservices.codeplex.com/wikipage?title=$().SPServices.SPDisplayRelatedInfo&referringTitle=Documentation - I think there is an example of how to use SPDisplayRelatedInfo at the bottom of this page?
Jul 15, 2013 at 1:01 PM
Hi Alibby,

Yes, I saw this documentation but I cant seem to find the proper way to display the result in a text field.

Thanks,

Arnel
Coordinator
Jul 15, 2013 at 1:05 PM
Arnel:

SPDisplayRelatedInfo is designed to show the related info directly below the dropdown. If you want to use those values to populate other fields, you'll need to write your own script in the completefunc (or write code to grab the values yourself) to do it.

Note that if you are in 2010 or 2013, you can just "pull" those values across in the lookup column settings; no script required.

M.
Jul 16, 2013 at 12:42 AM
Hi Marc,

Sorry, but I'm not good in writing scripts. Fortunately, were in SP foundation 2010. Can you shed me some light how to do this just using the built-in function of 2010?

Thank you very much,

Arnel
Coordinator
Jul 16, 2013 at 1:45 PM
In the list settings, look at the settings for the lookup column. You can select which other values from the lookup list you'd like to pull across.

M.
Jul 17, 2013 at 1:03 AM
Thanks Marc! This works but it seems like I really need to have a script here in order to display that value from the other lookup into the text field. Can you write an example script for this please that I can follow for building the script that I need?

Thanks again,

Arnel
Coordinator
Jul 17, 2013 at 3:16 AM
Arnel:

Those values will be populated into the current item without you doing anything. I don't think you need any script, but I may be misunderstanding your goals.

M.
Jul 17, 2013 at 3:52 AM
Okay Marc. I have these below list now. They have been slightly modified from my above post.

Suppliers: Name, EmailAddress (Columns)
Initiator: Company (Lookup for Name),EmailAddress (Columns)

In my new customized form on Initiator's List, I wish that the "EmailAddress" will be populated by the EmailAddress value from Suppliers List when I select an item from the Company drop-down list since it is the lookup column for the Suppliers List.

I tried setting up the calculated value of Initiator's EmailAddress text field to be "=[Company:EmailAddress]" but it doesn't work, its gives me an error saying that this is not an existing field. [Company:EmailAddress] is the additional lookup field that has been added.

That's why I mentioned earlier that it works. It just needs be displayed on the "EmailAddress" text field. Please advise.

Thanks,

Arnel