You are viewing limited content. For full access, please sign in.

Question

Question

How can you populate a dropdown with lookup values without clearing the choice list?

asked on October 20

Drop down field is not being populated with "Append" option selected

I need to populate a dropdown/radio/checkbox with a value from a lookup table. I need it to populate but still allow for the previous list of options to be selectable. In Laserfiche 11 I was only able to make dropdowns populate properly without use of JavaScript. 

 

Laserfiche 11:

If I selected "Append Choices to lookup results": The table result would be the default selected option, and the user could pick any other drop-down choice. For example: "1" would be selected but the user could still choose 2-5.


Laserfiche 12:
The only way to populate the drop down is if I turn off the "Append Choices to Lookup Results" button. Am I doing something wrong?
 

Side note: 

Selecting "Append choices to lookup results" does nothing for checkboxes/radio.
Not selecting the option makes it so the lookup result becomes the only option the user can pick but also doesn't select it on default. Becoming the worst of both worlds.

Ticket1.PNG
Ticket2.PNG
Ticket3.PNG
Ticket4.PNG
Ticket5.PNG
Ticket1.PNG (36.07 KB)
Ticket2.PNG (2.84 KB)
Ticket3.PNG (36.46 KB)
Ticket4.PNG (3.17 KB)
Ticket5.PNG (20.95 KB)
0 0

Replies

replied on October 20

Daniel, I believe this is the same thing I just posted about as well: https://answers.laserfiche.com/questions/232239/Append-Choices-to-Lookup-Results-Breaks-Lookup-Matching

1 0
replied on October 21

Thank you for bringing this up, you are correct. I checked my version and saw I was also on 12.0.2503.10378.

0 0
replied one day ago

I have a workaround that appears to be working for me on version 12.0.2503.10378 - at least in the Form Preview, I haven't tested in an actual process.
Javascript for Layout Designer:

/*Option 1 - Manual List of Options:
Rather than using the "Append choices to lookup results"
option to manually add values to the dropdown,
we are using this Javascript. This ensures that the single
value loaded from the lookup is auto-selected.
This function runs when the field is changed by the lookup
and when the form is first loaded.*/
LFForm.onFieldChange(AddDepartmentsToDropdown, {variableName: "department"});
AddDepartmentsToDropdown();
function AddDepartmentsToDropdown() {
  const additionalValues = [
    "Human Resources",
    "Accounting",
    "Contact Center"
    ];
  LFForm.changeFieldOptions( {variableName: "department"}, additionalValues, "add" );
}

/*Option 2 - List of Options from Lookup:
Rather than using two lookups to populate
options in the dropdown (one for the single selected
value and one for the list of possible values).
We are using this Javascript. This ensures that the single
value loaded from the lookup is auto-selected.
This does require two fields, one for each lookup.
The departments_from_lookup field can be hidden from view.
This function runs when the fields are changed by the
lookups and when the form is first loaded.*/
LFForm.onFieldChange(AddDepartmentsToDropdown2, {variableName: "departments_from_lookup"});
LFForm.onFieldChange(AddDepartmentsToDropdown2, {variableName: "department2"});
AddDepartmentsToDropdown2();
function AddDepartmentsToDropdown2() {
  let fullList = LFForm.findFieldsByVariableName("departments_from_lookup")[0].options;
  LFForm.changeFieldOptions( {variableName: "department2"}, fullList, "add" );
}

 

1 0
replied 3 hours ago

So now I'm testing this in an actual process, and the instance says the value is saved from what I selected on the first submission, but it doesn't show on the field itself on later tasks, and nothing I do with the field settings or Javascript seems to resolve it.  It seems like the changes they made to the code for lookups on dropdowns is buggy or something.

0 0
replied on October 21

Just to confirm — are you saying that after enabling "Append Choices to Lookup Results", the dropdown choices are not automatically selected, or that the lookup results don’t appear in the dropdown choices at all?

0 0
replied on October 22

The issue is that the dropdown choices are not automatically selected. The appending itself has no issue.

0 0
replied on October 22

Sorry for the earlier misunderstanding.
When the "Append Choices to Lookup Results" option is checked, which means multiple choices will appear in the dropdown. In this case, it is expected behavior that no choice is automatically selected.
Similarly, when the "Append Choices to Lookup Results" option is unchecked, and the lookup rule returns multiple values, the dropdown will also not select any choice automatically. These behaviors are expected.

0 0
replied on October 23

How is it expected if the behavior changed between versions with no patch notes regarding dropdown population. 

 

LF 11
Scenario - "Append Choices..." Checked, Lookup rule attempts to populate with 1 result.

--> The original dropdown choices remain but the lookup selects a choice based on the result

LF 12
Scenario - Same

--> The original dropdown choices remain but the lookup selects nothing and adds nothing if the choice is already present. (Nothing happens at all)

 

0 0
replied on October 22

I could be mistaken or totally misunderstanding…  But I feel like to have the “Append Choices to Lookup Results” option continue to work properly, you really need to also have the “Assign Values to Choices” option turned on too.

It might be a bug that it doesn’t work well without the values enabled, but I feel like this is something I have encountered as well.

0 0
replied on October 23

Thank you for bringing this up, I tested to see if it would fix anything and got the same results as before. 

Ticket1-1.PNG
Ticket1-2.PNG
Ticket1-1.PNG (37.84 KB)
Ticket1-2.PNG (3.12 KB)
0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.