How to have a text field populate based on a drop down field choice

  • 25 April 2016
  • 3 replies
  • 2 views

Badge +6

Hello,

I have a drop down field on my form which is a list of people. When the user selects a person from the drop down I would like a text field on the form to populate with the persons email address. I know this may be a javascript solution however the little javascript I know but I can't get it to work.

I understand this may be a simple solution and I have searched this community and found answers but the ones I did find assumed I knew about storing variables. With that in mind, if you know of a solution I would appreciate it you treated me like I know nothing when you are detailing a solution.

Thanks in advance

Andrew


3 replies

Badge +16

hi this is possible without javascript.  You can use a calculated field and in the formula use runtime functions

userProfileLookup("domainlogin", "InternalPropertyName")

WorkEmail works for me as InternalPropertyName and just replace user with value of control.

Badge +16

Hi

To expand on this, you say a dropdown list of people...  is that looking at a choice column in your list or is it stored as a person or group field?

in the control toolbox in forms designer you should see "Calculated Value".  Drag it on to your canvas.  Double click it to configure.

CalculatedValue.PNG

In the control settings, choose the button next to formula to access the forumal builder.

Choose runtime functions tab, scroll to the bottom and double click userProfileLookup.  Add the named control (dropdown) as the first parameter in the function, and the internal property name as the second parameter in quotation marks.  save and preview your form.  you should see it changing (assuming the value behind the selected dropdown is the domainlogin).

Badge +6

Thanks. This worked.

Andrew

Reply