I've currently got a requirement to populate some editable controls in the form with a value based on the result of a lookup to another list.
The runtime lookup function is great for displaying information from another list based on values from other controls in the form. Is there any way we can put this information into a textbox for example? e.g. When a user selects a department lookup, the form will look at a list containing approvers and get the person associated with the selected department and populate a person control.
Would appreciate any inputs or suggestions in meeting this requirement. Thanks in advance.
Solved! Go to Solution.
No answer for you, but I have a similar need and was wondering if you were able to solve this.
I have a form for contact persons.
Contact persons have a lookup column to an organization.
After selecting the organization I would like to copy the address fields of the organization to the address fields of the contact person.
In my case decided to use workflow to populate the fields we require after the user has submitted the form. (we wanted to keep customizations to a minimum)
If you do not have a need for the user to edit the address field on the form I suggest making use of the calculated value control with the lookup function. The thing with this is that you can connect a calculated value control to a column in your form's list.
If you are in my scenario where you want to populate the value but allow a user to override or change it, you will need to consider other options.
you can call that by setting the formula in a Calculated Field control as follows:
setMyControl(lookup("myList", "Id", myDropDownControl, "myFillInColum"))
For more information, check out my blog post about this:
This is really awesome and exactly what I was looking for.
I believe so.
The important thing to note is that the reference to the control has to be in the formula. If it's in the JS function, it will work once, but the function will not be called again when the control is changed.
I guess there is no way around the function working once? E.g. If I select a value in the drop down, it will populate the text field, but If I change it again, it will not change the populated value?
Sorry, I may have confused things for you a little bit.
As long as the reference to the named control is in the formula of the calculated field (or variable) then the function will be called again (and the populated value would change). My original reply demonstrates how to get that functionality.